The gdb native to Ubuntu 16.04 should be able to pretty print a std::map
; the python code which handles that is class StdMapPrinter
in the following file from the libstdc++6
package:
/usr/share/gcc-5/python/libstdcxx/v6/printers.py
If your goal is to accomplish this with binaries you build from source, it might still be useful to get this working with the native Ubuntu packages first, as a basis for comparison. The likely reason pretty printers are not working in a gdb you built yourself is that libstdcxx/v6/printers.py
(libstdcxx.v6.printers
in the python namespace) is not where gdb expects to find it.
Also, the gdb native to Ubuntu 16.04 is linked against python3, not python2; one way to see that is in the output of
ldd /usr/bin/gdb
It appears that the libstdcxx.v6.printers
native to Ubuntu 16.04 is intended to work with either python2 or python3.
If your native gdb binary is not already installed, you can use this:
apt install gdb