...
Working example:
The image shows features:
-
- debugger is paused when condition is met
-
- stepping
-
- callstack
-
- variables + imediate window shows content of an item of a vector
-
- pretty printing
-
- foreign code step trhough
C/C++ ms-vscode.cpptools Preview
For vscode is better to have clang, lldb
but it can work without them. C/C++ vscode plugin is mandatory.
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${env:JANA_HOME}/bin/janadump",
"args": ["-PPLUGINS=jleic_root_reader,vtx_fit", "hits.root", "-DMCGenerated", "-DVertexTrackerTrack"],
"stopAtEntry": false,
"cwd": "/home/romanov/jleic/work",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Things to highlight:
-
${env:JANA_HOME}
uses environment variable 'JANA_HOME'. That is the way any other environment variable can be used.
-
cwd
is the directory where the program is running. In the above example it is wherehits.root
and other required stuff is placed.
Otherwise it is pretty standard gcc debugging configuration found on internet
Life hacks:
-
- If you intend to close vscode, change environment variables and open it again (like JANA_HOME in the above example), all other working vscode processes should be killed (in order for changes to make effect). Why? TL;DR; - because vscode doesn't block your terminal when you run "vscode "
Launch configurations in general
Debugging launch.md description
Configuring includePath for better IntelliSense results