转自:http://lumiera.org/documentation/technical/howto/DebugGdbPretty.html
Installation notes
This feature requires an python enabled GDB (>6.8.50). Actually, even the most recent stableGDB (Version 7.2) is recommended, because it contains some relevant bugfixes. Debian usersmight want to backport the the GDB package from Debian/Wheezy (GDB-7.2).Moreover, you need to check out and install a recent version of the python pretty-printersfrom the GNU Subversion repository:
-
svn checkout svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python stlPrettyPrinter
-
you need to activate them explicitly through your +~/.gdbinit
#
# .gdbinit : GDB Config file
#
# 3/2010 - Ichthyo: add python pretty printers for STL
python
import sys
sys.path.insert(0, '/opt/gdb/stlPrettyPrinter')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end