# Use Qt Creator as IDE or GUI Debugger [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. [TOC] ## IDE ### Workflow 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. ### Setup as IDE 1. Install latest Qt Creator 2. under chromium/src `gn gen out/Default --ide=qtcreator` 3. qtcreator out/Default/qtcreator_project/all.creator It takes 3 minutes to parsing C++ files in my workstation!!! And It will not block you while parsing. #### Code Style 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 ``` CodeStyleData true false false false false true true true true false false false true false false true false false false 2 true false 2 true true 2 DisplayName chrome ``` #### Build & Run In left panel, projects - setup the ninja command in build and clean step and executable chrome path in run. ## Debugger **You can skip the project settings and use QtCreator as a single file 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. 4. Debug - Start Debugging - Attach to running Application, you may need to open chrome's task manager to find the process number. ### Tips, tricks, and troubleshooting #### Debugger shows start then finish ``` $ 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 Ensure you are using GDB not LLDB in Linux. #### More See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_debugging.md