gdb’s backtrace command implemented in python
I’ve been working on Python bindings for exposing GDB’s frame_info, the internal structure it uses to keep track of the frame stack in the debuggee (or inferior, in GDB parlance). I got just enough working to be able to implement an equivalent of GDB’s backtrace command entirely in Python. The difference is that my version of the command prints older frames first and newer last, which feels more natural to me.
Here’s the output I get:
(gdb) rbt
#2 0x080483bb in main at ../../src/examples/funcs.c:15
#1 0x08048391 in f1 at ../../src/examples/funcs.c:10
#0 f2 at ../../src/examples/funcs.c:5
(gdb)
A little bit more information, and the definition of the Python command which does the above can be found in my post to the mailing list. The code is on the git repo for the Python work.
Thursday, October 16, 2008 at 03:05
[...] October 16, 2008 by bauermann It’s been a great while since I last posted about Python scripting in GDB, mostly because I’ve been busy coding the feature and getting [...]