Search code examples
gdblldb

What is the equivalent of 'info frame' for lldb?


I try to use lldb the LLVM debugger, but I am quite used to gdb. So, I am looking for the equivalent of the gdb command info frame for lldb.

I want to display information about the current frame with the location of the saved registers (saved program counter and saved base pointer). For example, the info frame command of gdb display the following information:

Stack level 0, frame at 0x7fffffffe090:
 rip = 0x4004ba in main (example.c:6); saved rip = 0x7ffff7a54b45
 source language c.
 Arglist at 0x7fffffffe080, args: 
 Locals at 0x7fffffffe080, Previous frame's sp is 0x7fffffffe090
 Saved registers:
  rbp at 0x7fffffffe080, rip at 0x7fffffffe088

Solution

  • There isn't a command that presents all this information at a glance. Some of it is easily available to you, for instance:

    (lldb) frame variable -L
    

    Will show you the location of args & locals - though it will show you values as well. The frame printing generally shows the pc and source info, and reg read sp will show the stack pointer. Or you can add fp & sp to your regular frame format (see this page for more details).

    There is a frame info command that shows a fairly simple view of the current frame. It could certainly be extended to show more of this info (maybe under a -v flag.) Feel free to file a bug with lldb.llvm.org's bugzilla requesting this, or dive in and add it yourself if you feel so motivated.

    It wouldn't be hard to write a Python command to gather all this information and present it as you would like if you are somewhat motivated, but not enough to start hacking on lldb proper.