visualize-c-memory
visualize-c-memory copied to clipboard
visualize-c-memory
Real-time visualization of the memory of a C program during debugging in VSCode, using vscode-debug-visualizer and GDB's Python API.

To try it
-
Install graphviz.
sudo apt install graphviz -
In VSCode, install vscode-debug-visualizer.
Ctrl-P / ext install hediet.debug-visualizer -
Clone this repository, open it in VSCode and start debugging (
F5).If the debugger doesn't start, make sure that
gdb,makeand VSCode's ms-vscode.cpptools are installed. -
Select
F1 / Debug Visualizer : New Viewand write"memory"(including the quotes) in the visualization window that opens. -
A visualization of both the stack and the heap will appear, and it will update as you step through the code (
F10,F11, etc). -
Modify
examples/examples.cto try your own code.
Tested in Ubuntu 20.04 and Windows 10 under WSL. macOS is not supported (it could be adapted, but Apple makes it particularly painful to use GDB in macOS anyway).
To use it in your own project
- Build
visualize-c-memory.so(by runningmakeinsrc). - Load the
.soand the python module in GDB by adding the following to yourlaunch.json:
See .vscode/launch.json for an example."environment": [ {"name":"LD_PRELOAD", "value":"${workspaceFolder}/<path-to>/visualize-c-memory.so"}, ], "setupCommands": [ { "text": "source ${workspaceFolder}/<path-to>/visualize-c-memory.py" } ],