|
| 1 | +# FAQs |
| 2 | + |
| 3 | +## Table of Contents |
| 4 | +* Setup |
| 5 | + * [Debugging Setup](#debugging-setup) |
| 6 | + |
| 7 | +* Debugger |
| 8 | + * [Why is debugging not working](#why-is-debugging-not-working)? |
| 9 | +* Build |
| 10 | + * [How to enable debug symbols](#how-to-enable-debug-symbols) |
| 11 | + |
| 12 | +## Debugging Setup |
| 13 | +The debugger needs to be configured to know which executable and debugger to use: |
| 14 | + |
| 15 | +Click menu item: `Debug` -> `Add Configuration...` |
| 16 | + |
| 17 | +The `launch.json` will now be open for editing with a new configuration. The default settings will *probably* work except that you need to specify the **program** setting. |
| 18 | + |
| 19 | +See the [`Documentation/Debugger`](https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation/Debugger) folder in this repository for more in-depth documentation on how to configure the debugger. |
| 20 | + |
| 21 | +## Why is debugging not working? |
| 22 | + |
| 23 | +### My breakpoints aren't being hit |
| 24 | + |
| 25 | +When you start debugging, if it is showing that your breakpoints aren't bound (solid red circle) or they are not being hit, you may need to enable [debug symbols](#how-to-enable-debug-symbols) during compilation. |
| 26 | + |
| 27 | +### Debugging starts but all the lines in my stack trace are grey |
| 28 | + |
| 29 | +If your debugger is showing a grey stacktrace or won't stop at a breakpoint,or the symbols in the call stack are grey then your executable was compiled without [debug symbols](#how-to-enable-debug-symbols). |
| 30 | + |
| 31 | +## How to enable debug symbols |
| 32 | + |
| 33 | +Enabling debug symbols are dependent on the type of compiler you are using. Below are some of the compilers and the compiler options necessary to enable debug symbols. |
| 34 | + |
| 35 | +When in doubt, please check your compiler's documentation for the options necessary to include debug symbols in the output. This may be some variant of `-g` or `--debug`. |
| 36 | + |
| 37 | +#### Clang (C++) |
| 38 | +If you invoke the compiler manually then add the `--debug` option. |
| 39 | + |
| 40 | +If you're using a script then make sure the `CXXFLAGS` environment variable is set; e.g. `export CXXFLAGS="${CXXFLAGS} --debug"` |
| 41 | + |
| 42 | +If you're using cmake then set make sure the `CMAKE_CXX_FLAGS` is set; e.g. `export CMAKE_CXX_FLAGS=${CXXFLAGS}` |
| 43 | + |
| 44 | +#### Clang (C) |
| 45 | +See Clang C++ but use `CFLAGS` instead of `CXXFLAGS`. |
| 46 | + |
| 47 | +#### gcc or g++ |
| 48 | +If you invoke the compiler manually, add the `-g` option. |
| 49 | + |
| 50 | +#### cl.exe |
| 51 | +Symbols are located in the `*.pdb` file. |
0 commit comments