docs: Add instructions for using qtcreator's issues pane
Add instructions for getting compiler errors into qtcreators Issues pane when building with ninja, and other general cleanup. TBR=chaopeng@chromium.org Change-Id: I23e238e48a688a993cf2b40b9979f94d9fe18305 Reviewed-on: https://chromium-review.googlesource.com/680715 Reviewed-by: Sam McNally <sammc@chromium.org> Reviewed-by: Chris Watkins <watk@chromium.org> Commit-Queue: Chris Watkins <watk@chromium.org> Cr-Commit-Position: refs/heads/master@{#504543}
This commit is contained in:

committed by
Commit Bot

parent
d61aa8912c
commit
7374d03c6a
@ -1,41 +1,42 @@
|
||||
# Use Qt Creator as IDE or GUI Debugger
|
||||
# Use Qt Creator as an IDE or debugger UI
|
||||
|
||||
[Qt Creator](https://www.qt.io/ide/)
|
||||
([Wiki](https://en.wikipedia.org/wiki/Qt_Creator)) is a cross-platform C++ IDE.
|
||||
|
||||
You can use Qt Creator as a daily IDE or just as a GDB frontend and that does
|
||||
not require project configuration.
|
||||
You can use Qt Creator as a daily IDE or just as a GDB frontend (which does
|
||||
not require project configuration).
|
||||
|
||||
[TOC]
|
||||
|
||||
## IDE
|
||||
|
||||
### Workflow
|
||||
### Workflow features
|
||||
|
||||
1. `ctrl+k` Activate Locator, you can open file(not support sublime-like-search)
|
||||
or type `. ` go to symbol.
|
||||
2. `ctrl+r` Build and Run, `F5` Debug.
|
||||
3. `F4` switch between header file and cpp file.
|
||||
4. `ctrl+shift+r` rename symbol under cursor.
|
||||
5. Code completion is built-in. And you can add your snippets.
|
||||
* Built-in code completion.
|
||||
* Navigate to classes, files, or symbols with `ctrl+k`.
|
||||
* Switch between declaration and definition with `F2`.
|
||||
* Build with `ctrl+shift+b`.
|
||||
* Build and run with `ctrl+r`, or debug with `F5`.
|
||||
* Switch between the header file and cpp file with `F4`.
|
||||
|
||||
### Setup as IDE
|
||||
### Setup
|
||||
|
||||
1. Install latest Qt Creator
|
||||
2. under chromium/src `gn gen out/Default --ide=qtcreator`
|
||||
3. qtcreator out/Default/qtcreator_project/all.creator
|
||||
4. Help - Plugins - check ClangCodeModel to enable std completion
|
||||
1. Install the latest Qt Creator.
|
||||
2. Under chromium/src `gn gen out/Default --ide=qtcreator`.
|
||||
3. Start it with `qtcreator out/Default/qtcreator_project/all.creator`.
|
||||
4. Help - Plugins - check ClangCodeModel to enable std completion.
|
||||
|
||||
It takes 3 minutes to parsing C++ files in my workstation!!! And It will not
|
||||
block you while parsing.
|
||||
It takes 3 minutes to parse all of chrome's C++ files on my workstation!!! And
|
||||
it does not block while parsing.
|
||||
|
||||
#### Code Style
|
||||
|
||||
1. Help - About Plugins enable Beautifier.
|
||||
1. Help - About Plugins, enable Beautifier.
|
||||
2. Tools - Options - Beautifier - Clang Format,
|
||||
change Clang format command: `$depot_tools_dir/clang-format`, select use
|
||||
predefined style: file. You can also set a keyboard shortcut for it.
|
||||
3. Tools - Options - Code Style import this xml file
|
||||
change the Clang format command to: `$depot_tools_dir/clang-format`, and
|
||||
set `Use predefined style: file`. You can also set a keyboard shortcut
|
||||
for it.
|
||||
3. Tools - Options - Code Style, import this xml file.
|
||||
|
||||
```
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
@ -84,36 +85,46 @@ block you while parsing.
|
||||
|
||||
#### Build & Run
|
||||
|
||||
In left panel, projects - setup the ninja command in build and clean step and
|
||||
executable chrome path in run.
|
||||
1. (Optional) Enable the issues pane for easy navigation to the location of
|
||||
compiler errors. qtcreator expects to find compiler errors on stderr, but
|
||||
ninja forwards all subcommand output to stdout. So use the following wrapper
|
||||
script to forward it to stderr instead.
|
||||
```
|
||||
#!/bin/sh
|
||||
/path/to/depot_tools/ninja "$@" >&2
|
||||
```
|
||||
2. In the left panel - Projects, set up the ninja command in the build and
|
||||
clean steps, and add the path to chrome in the run configuration.
|
||||
|
||||
|
||||
## Debugger
|
||||
|
||||
**You can skip the project settings and use QtCreator as a single file
|
||||
standalone GDB frontend. **
|
||||
standalone GDB frontend.**
|
||||
|
||||
1. Tools - Options - Build & Run - Debuggers, make sure GDB is set.
|
||||
2. Tools - Options - Kits, change the Desktop kit to GDB(LLDB doesnot work in
|
||||
Linux).
|
||||
3. Open file you want to debug.
|
||||
2. Tools - Options - Kits, change the Desktop kit to GDB (LLDB doesn't work on
|
||||
Linux).
|
||||
3. Open the file you want to debug.
|
||||
4. Debug - Start Debugging - Attach to running Application, you may need to
|
||||
open chrome's task manager to find the process number.
|
||||
open chrome's task manager to find the process id.
|
||||
|
||||
### Tips, tricks, and troubleshooting
|
||||
|
||||
#### Debugger shows start then finish
|
||||
#### The debugger exits immediately
|
||||
|
||||
Ensure yama allows you to attach to another process:
|
||||
|
||||
```
|
||||
$ echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
|
||||
```
|
||||
|
||||
Ensure yama allow you to attach another process.
|
||||
|
||||
#### Debugger do not stop in break point
|
||||
#### The debugger does not stop on breakpoints
|
||||
|
||||
Ensure you are using GDB not LLDB in Linux.
|
||||
Ensure you are using GDB on Linux, not LLDB.
|
||||
|
||||
#### More
|
||||
|
||||
See
|
||||
https://chromium.googlesource.com/chromium/src/+/master/docs/linux_debugging.md
|
||||
https://chromium.googlesource.com/chromium/src/+/master/docs/linux_debugging.md
|
||||
|
Reference in New Issue
Block a user