-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can i see the value of elements in STL containers or arrays in debug #1414
Comments
You need to set up python pretty printers for C++ in the .gdbinit file. Have a look here: |
@philong6297 Also make sure you have the following block in your
|
For the record, you need both of those, and they can both be wrapped in the Modern OSes like Fedora and Ubuntu include the svn submodule, and you don't need to download them separately. For example, in Ubuntu 18.04
|
not sure why |
How do I do the same for Windows? |
Any idea why @andyneff 's suggestion can't be rolled into vscode-cpptools so that it works out of the box? I've been struggling with debugging STL in vscode for a while now, and this suggestion is going to make it a lot easier. |
@WardenGnaw can we see if we can get a test matrix with @andyneff's suggestion above and wee where it works and where it doesn't? we would need to at the bare minimum set up Arch, Ubuntu, Centos and WSL1/2 |
I'm on Ubuntu 20.04 and none of the suggestions here are having any effect at all, though they do work on a RHEL system I have access to. Any suggestions? Edit: It appears to be due to the fact that I'm using CUDA-gdb not GDB. If anyone has any suggestions I'd love them otherwise I'll go ask the NVIDIA people |
On Ubuntu 22.04, this seemed to work: "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
}
] |
@sajedehkebriti You need the |
|
the same question in gdb 13.2 use gdb init from [https://github.com/cyrus-and/gdb-dashboard]. did u solve this problem? |
@pieandcakes any progress on that front? |
For example with
std::vector<std::vector> v(10,vector<int>(5,-1))
. When I run the debug with GDB, i can only see the address of the first and last element. When i expand the_M_start_
or_M_finish_
, it still show the address, not the value i need to see. How can i see the value of elements in STL or arrays in debug:The text was updated successfully, but these errors were encountered: