Type: Debugger
Describe the bug
The debugger crashes with a NullReferenceException if the "description" field is missing from an element inside the "customLaunchSetupCommands" list (inside a launch.json configuration).
Debug console output (with all logging enabled):
Stopping due to fatal error: NullReferenceException: Object reference not set to an instance of an object
This was not an issue in earlier versions of cpptools (<=0.24.1)
To Reproduce
example of launch.json wich causes the issue:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"customLaunchSetupCommands": [
{ "text": "target-run", "ignoreFailures": false }
],
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
The issue is fixed by adding the "description" field the element inside "customLaunchSetupCommands", like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"customLaunchSetupCommands": [
{ "text": "target-run", "description": "run target", "ignoreFailures": false }
],
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
Strange that this wasn't an issue before as I don't think anything changed here.
I confirm that adding "description" solves the problem, as such:
{
"name": "eme-cpp-launch",
"type": "cppdbg",
"request": "launch",
"MIMode": "gdb",
"program": "${workspaceRoot}/elemental_se/bin/eme",
"setupCommands": [
{"text": "set breakpoint pending on", "description": ""},
{"text": "set print array on", "description": ""},
{"text": "set print pretty on", "description": ""},
{"text": "-enable-pretty-printing", "description": ""},
{"text": "set target-async 1", "description": ""},
{"text": "set print elements 5000", "description": ""},
{"text": "set sysroot remote:/", "description": ""},
],
"stopAtEntry": false,
"args": [ "--test" ],
"cwd": "${workspaceRoot}",
"targetArchitecture": "x64",
"externalConsole": false
},
thanks for checking. I have a fix pending.
Reopen until we ship
Fixed with 0.25.1.
Most helpful comment
I confirm that adding "description" solves the problem, as such: