Is there a GUI (or even a script for the CLI) for GDB that will annotate views of the stack with saved registers, each of the frames, etc? It should be possible to gather this information on each call and add it to a view of the stack. Currently, I just end up looking at the stack with something like x/40wx $esp, which isn't amazingly enlightening.

  • Which version of GDB? Can the versions be assumed to support Python already or not? Also, only particular registers get saved with a call. Have you checked whether the frame or the backtrace command shows what you are interested in? Automating traversal of the frames should be possible.
    – 0xC0000022L
    May 2, 2013 at 12:00

1 Answer 1


As 0xC0000022L was mentioning it in the comments to your question, GDB already has such features through the info frame command (shorthand i f) and the backtrace command (shorthand bt).

(gdb) info frame
Stack level 0, frame at 0x7fffffffe250:
 rip = 0x400517 in foo (hello.c:6); saved rip 0x400531
 called by frame at 0x7fffffffe260
 source language c.
 Arglist at 0x7fffffffe240, args: val=10
 Locals at 0x7fffffffe240, Previous frame's sp is 0x7fffffffe250
 Saved registers:
  rbp at 0x7fffffffe240, rip at 0x7fffffffe248
(gdb) backtrace
#0  foo (val=10) at hello.c:6
#1  0x0000000000400531 in main () at hello.c:12

You may find some other commands about stack exploration in the GDB manual: Examining the stack.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.