Extensions in Python
Various GDB extensions have been written in Python. This page lists the ones we know of.
Tutorials
David Malcolm gave a couple of presentations at PyCon about various Python features of GDB:
A deep dive into how Python uses memory. This one focuses on the gdb-heap extension.
Using Python to debug C and C++ code (using gdb). This is a general introduction to the Python API in GDB.
Pretty Printers
Various projects have implemented pretty-printers for their data structures. In many cases, these are shipped with the project in question.
- See STLSupport for instructions on setting up a suite of pretty-printers for GCC's libstdc++. (On most recent Linux distributions, this is installed automatically.)
General Features
There are also various projects to extend GDB in more general ways using Python:
A simple implementation of "info mutex". This is not fully baked, but may still be useful.
Miscellaneous commands. During the development of the Python branch, we wrote various commands that have not yet been incorporated into GDB. This tree includes a simple pahole, a replacement for backtrace, alias, ignore-errors, fancier up and down commands, and convenience functions $caller_is and $in_scope.
A Python version of the cool "Duel" extension, and some helper code for writing pretty-printers
Various gdb helpers, including a frame filter to colorize stack traces