How to display STL STL containers in GDB / Nemiver on Linux

I am using Linux (Ubuntu 11.10) and gdb 7.3 / Nemiver 0.8.2.
I would like to display the contents of STL containers, but so far I have not been really successful.

Is there another visual debugger (better based on gdb) that I should use to display STL container variables?
I am looking for a solution that supports the composition of containers (i.e. std::map<int, std::vector< std::pair< ... > > > ).

Greetings

+4
source share
2 answers

Newer versions of GDB support the fairly printable API from Python. This allows applications to provide Python code to customize some aspects of the display of objects. This code is designed to work with both the CLI ("print" on the gdb command line) and MI (an interface that uses the GUI, or at least should use).

New versions of GCC supply Python pretty-printers for all important data structures in libstdc ++.

The final step is to get the new version of nemiver. I think 0.9.2 has this feature.

Many gdb and gcc distributions are configured so that cute printers are automatically activated if your program uses libstdc ++. So maybe just upgrading a nemiver would be enough for you. Otherwise, there are many documents online on how to set this up.

0
source

Download the following file -

https://github.com/jgarvin/joe-etc/blob/master/gdb/stl-views-1.0.3.gdb

From GDB -

 # source <PATH>/stl-views-1.0.3.gdb # pmap <map-object> <key-type> <value-type> 

...

0
source

All Articles