I have the following debug configuration:
{
"preLaunchTask": "Build gcc",
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"internalConsoleOptions": "openOnSessionStart",
"MIMode": "gdb",
"miDebuggerPath": "C:/MinGW/mingw64/bin/gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"logging": {
"moduleLoad": true,
"engineLogging": true,
"trace": false
}
}
It works, but I was hoping to be able to add to the command-line options that are passed to gdb. In the debug console, I can see Starting: "C:/MinGW/mingw64/bin/gdb.exe" --interpreter=mi. Is there any way to setup launch.json to pass other options than --interpreter=mi to gdb as it is called (i.e. before it is running)?
It looks like setupCommands are called using -exec after gdb is already running. In the readme for customLaunchSetupCommands it mentions something about "....which can be useful if the debugger is being provided launch options as command line options", but I don't see how to pass any command line options.
Thanks!
Extension version: 0.17.6
VS Code version: Code 1.25.1
OS version: Windows 10.0. 4393 x64
I see from here that I can wrap the call to gdb in a batch file, e.g.:
call "C:\MinGW\mingw64\bin\gdb.exe" --interpreter=mi --silent
and then place the path to my batch file in the "miDebuggerPath" launch.json option. This works. However, it would be preferable to define the additional flags in launch.json, in case the required options passed to gdb by the extension change at some later date.
@jlj-ee You should be able to use "miDebuggerArgs" to specify additional args.
I see its missing from our launch.md documentation and I'll get it added.
Most helpful comment
@jlj-ee You should be able to use
"miDebuggerArgs"to specify additional args.I see its missing from our launch.md documentation and I'll get it added.