feat(debug): add GDB-based debug visualizer for linked lists

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.
This commit is contained in:
mynameisdeleted
2026-07-09 12:14:27 -04:00
parent 273d4dbf2b
commit a8d105005e
6 changed files with 511 additions and 32 deletions

20
.vscode/launch.json vendored
View File

@@ -19,6 +19,21 @@
"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
}
]
},
@@ -50,6 +65,11 @@
"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
}
]
}

View File

@@ -1,5 +1,10 @@
{
"debugVisualizer.customVisualizerScriptPaths": [
"${workspaceFolder}/vis-plugins/node-table-visualizer.js"
]
],
"debugVisualizer.debugAdapterConfigurations": {
"cppdbg": {
"expressionTemplate": "$debug_graph(${expr})"
}
}
}