When I debug my application through a terminal and gdb, everything works as expected, however if I try to use gdb as the debugger for vs code, it exists immediately with output:
Breakpoint 1, main (argc=1, argv=0x7fffffffe638) at /home/kronos/Desktop/voxel-world/source/main.cpp:60
60 {
[Inferior 1 (process 7771) exited with code 01]
The program '/home/kronos/Desktop/voxel-world/build/voxel-world' has exited with code 1 (0x00000001).
This is my configuration file:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/voxel-world",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
First I would make sure that the program is not exiting with return code 1 by design (e.g., due to sanity checks etc.). You could start by setting
"stopOnEntry": true
in config file launch.json
, then proceed by debugging stepwise through main()
.
User contributions licensed under CC BY-SA 3.0