Debugging with gdb: pystack macro for gdb to show python stack trace

Timothy Madden terminatorul at gmail.com
Wed Sep 16 17:27:28 EDT 2009


Hello

I have an application with several threads that sometimes just freezes.

I installed the debug symbols for python interpreter, and the gdb 
macros, as instructed on the wiki 	
	http://wiki.python.org/moin/DebuggingWithGdb
so I can debug with gdb.

gdb loads many files with python debugging simbols, and it is loading 
the macros file ~/.gdbinit, but still the macros for working with python 
are not working. The pystack command just freezes the debugger until I 
press ^C, and other macros complain about undefined symbols. I would 
like to see the python stack trace so I know where my application 
freezes. All I could see from the gdb native stack trace (with bt) was 
that my 3 threads were waiting to acquire a lock, but I could not figure 
out where and my program logic should not allow this to happen.

Can I get the python stack trace working under gdb ?

Synaptic Package Manager on my Ubuntu netbook shows packages
python2.6     (2.6.2-0ubuntu1)
python2.6-dbg (2.6.2-0ubuntu1)
as installed, and I extracted the Misc/gdbinit file from
Python-2.6.2.tar.bz2 source archive from python.org. I have gdb 6.8-debian.
So I suppose everything should be right ...


Thank you,
Timothy Madden



More information about the Python-list mailing list