-
Enable
Allow breakpoints everywhere
setting -
Install both the
C/C++
andLanguage Support for Ada
extensions from VSCode Marketplace. -
Add a
.vscode/launch.json
file to your project, adapting the "program" line as necessary:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/binary_name",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
-
Build your binary with the
-g -O0
flags using Alire, GPRBuild or whatever. -
Put a breakpoint anywhere on your entrypoint and press the green "Play" symbol from the Debugging tab.
-
Profit!