how to print std::map value in gdb

how to print std::map value in gdb

I have a std::map< std::string, std::string> cont;

I want to see cont[ "some_key" ] in gdb. When I'm trying

p cont[ "some_ket" ]

I'm getting this message: One of the arguments you tried to pass to operator[] could not be converted to what the function wants.

I'm using GNU gdb Red Hat Linux ( Thanks

Use OpenBSD's malloc, realloc and free in my program


Strange results while measuring delta time on Linux
The latest gdb has python support baked in so one could easily write a function to print out the contents of any stl structure.

Java OutOfMemoryError due to Linux RAM disk cache not freed
However you'd have to learn the API and write the script.

Spring ResourceServlet throws too many open files exception in jetty and tomcat under linux
Luckily gcc 4.5 will ship with the needed python scripts to get gdb to intelligently handle stl data structures..
compile with -ansi -pedantic -Wall switches automatically with gcc
EDIT: you don't have to wait for GCC 4.5 (which by the way has already been released), you can just grab the code from SVN..
bluetooth application devlopment

C++ man pages in Ubuntu

how to make PHP lists all Linux Users?


You can write your own dump functions and call them:.
(gdb) call dump(m) 
see this thread: I'm curious about the GDB helper macros..


Gdb doesn't understand C++ operator overloading..

60 out of 100 based on 15 user ratings 140 reviews