I am having trouble inspecting std::set
and std::map
using the debugger in VS Code. I can see the content of a std::vector
of my classes, but for std::set
and std::map
, I only see the attached photo
I have followed this thread but the solution provided is for Windows users. I have also followed this GitHub thread and modified my launch.json
, but adding this only solved the problem for std::vector
, not for std::set
or std::map
. Here is my launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"preLaunchTask": "Build",
"program": "pathToExecutable",
"args": [],
"stopAtEntry": false,
"cwd": "/PathToProject/",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Test",
"text": "python import sys;sys.path.insert(0, '/usr/share/gcc/python');from libstdcxx.v6.printers import register_libstdcxx_printers;register_libstdcxx_printers(None)",
"ignoreFailures": false
},
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Please note that I have installed libstdc++6
:
libstdc++6 is already the newest version (12.1.0-2ubuntu1~22.04)
.
Also, this path /usr/share/gcc/python/libstdcxx
exists and contains:
__init__.py __pycache__ v6