Replace the custom toDebugGraph() method that generated JSON directly in C++ with a generic GDB Python script (debug_graph.py). The script traverses pointers and structures to build a graph representation for the VS Code Debug Visualizer, enabling external pointer display and more extensible visualization.
Update launch configurations to load the script and to disable array/string truncation (needed for the visualizer JSON). Add a debugAdapterConfigurations entry in settings.json to use the expression template $debug_graph(${expr}) for the cppdbg adapter.
78 lines
2.9 KiB
JSON
78 lines
2.9 KiB
JSON
{
|
|
"version": "0.2.0",
|
|
"configurations": [
|
|
{
|
|
"name": "Debug list_example (Rust)",
|
|
"type": "cppdbg",
|
|
"request": "launch",
|
|
"program": "${workspaceFolder}/target/debug/list_example",
|
|
"args": [],
|
|
"stopAtEntry": false,
|
|
"cwd": "${workspaceFolder}",
|
|
"environment": [],
|
|
"externalConsole": false,
|
|
"MIMode": "gdb",
|
|
"miDebuggerPath": "/usr/bin/rust-gdb",
|
|
"preLaunchTask": "cargo build",
|
|
"setupCommands": [
|
|
{
|
|
"description": "Enable pretty-printing for gdb",
|
|
"text": "-enable-pretty-printing",
|
|
"ignoreFailures": true
|
|
},
|
|
{
|
|
"description": "Don't truncate long arrays (needed for Debug Visualizer JSON)",
|
|
"text": "-gdb-set print elements 0",
|
|
"ignoreFailures": true
|
|
},
|
|
{
|
|
"description": "Don't truncate long strings (needed for Debug Visualizer JSON)",
|
|
"text": "-gdb-set print characters 0",
|
|
"ignoreFailures": true
|
|
},
|
|
{
|
|
"description": "Load the generic $debug_graph(...) Debug Visualizer helper",
|
|
"text": "source ${workspaceFolder}/gdb/debug_graph.py",
|
|
"ignoreFailures": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Debug list_example (C++)",
|
|
"type": "cppdbg",
|
|
"request": "launch",
|
|
"program": "${workspaceFolder}/cpp/list_example_cpp",
|
|
"args": [],
|
|
"stopAtEntry": false,
|
|
"cwd": "${workspaceFolder}/cpp",
|
|
"environment": [],
|
|
"externalConsole": false,
|
|
"MIMode": "gdb",
|
|
"miDebuggerPath": "/usr/bin/gdb",
|
|
"preLaunchTask": "g++ build cpp/main.cpp",
|
|
"setupCommands": [
|
|
{
|
|
"description": "Enable pretty-printing for gdb",
|
|
"text": "-enable-pretty-printing",
|
|
"ignoreFailures": true
|
|
},
|
|
{
|
|
"description": "Don't truncate long arrays (needed for Debug Visualizer JSON)",
|
|
"text": "-gdb-set print elements 0",
|
|
"ignoreFailures": true
|
|
},
|
|
{
|
|
"description": "Don't truncate long strings (needed for Debug Visualizer JSON)",
|
|
"text": "-gdb-set print characters 0",
|
|
"ignoreFailures": true
|
|
},
|
|
{
|
|
"description": "Load the generic $debug_graph(...) Debug Visualizer helper",
|
|
"text": "source ${workspaceFolder}/gdb/debug_graph.py",
|
|
"ignoreFailures": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|