js2854 / libstdc--v3python

a clone of svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python r221076 2015-02-28

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libstdc--v3python

When you try to use GDB's "print" command to display the contents of a vector, a stack, or any other GDB abstract data structure, you will get useless results. Instead, download and install one of following tools to properly view the contents of STL containers from within GDB.

  • [[GDB_7.0_Release|GDB 7.0]] will include support for writing pretty-printers in Python. This feature, combined with the pretty-printers in the libstdc++ svn repository, yields the best way to visualize C++ containers. Some distros (Fedora 11+) ship all this code in a way that requires no configuration; in other cases, [[http://lists.kde.org/?l=kdevelop&m=125326438617051&w=2|this email message]] explains how to set everything up. The main points have been redacted here:
  1. Check-out the latest Python libstdc++ printers to a place on your machine. In a local directory, do:
svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python
  1. Add the following to your ~/.gdbinit. The path needs to match where the python module above was checked-out. So if checked out to: /home/maude/gdb_printers/, the path would be as written in the example:
python
import sys
sys.path.insert(0, '/home/maude/gdb_printers/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end

The path should be the only element that needs to be adjusted in the example above. Once loaded, STL classes that the printers support should printed in a more human-readable format. To print the classes in the old style, use the {{{/r}}} (raw) switch in the print command (i.e., {{{print /r foo}}}). This will print the classes as if the Python pretty-printers were not loaded.

About

a clone of svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python r221076 2015-02-28


Languages

Language:Python 80.4%Language:Makefile 19.6%