pycon logo

PyCon 2011 Atlanta

March 9th–17th

Log in or Sign Up

Using Python to debug C and C++ code (using gdb)

log in to bookmark this presentaton

Experienced / Talk
March 11th 10:25 a.m. – 10:55 a.m.
Got a difficult C/C++ program to debug? The power of Python is now available from within the GNU debugger. I'll show how you can use simple fragments of Python to quickly track down fiddly bugs in C/C++ code. We'll also see how to use Python to extend gdb with new commands and new ways of visualizing the internal state of a program.


The GNU debugger, gdb, is the standard debugger when dealing with bugs in machine-code programs on Linux systems. As of gdb7 it supports a Python interface, allowing experienced Python programmers to extend the reach of the debugger. Difficult debugging tasks can be dramatically simplified by adding a little python.

I'm the author of two substantial bodies of gdb python code: pretty-printers for Python itself, and for the GNU libc implementation of "malloc/free".