0
votes

In gdb, it seems that whatever is located in the "Stack" section is always the same as the %rip register. For example:

rip 0x0000555555554603
─── Stack ────────────────────────────────────────────────────────────────────────────────────────
[0] from 0x0000555555554603 in main

And after doing si:

rip 0x0000555555554606
─── Stack ────────────────────────────────────────────────────────────────────────────────────────
[0] from 0x0000555555554606 in main

What exactly is the "Stack" section in gdb? It seems to me like it is more-or-less the instruction pointer (%rip) in the currently running function (and previous %rips in the call stack that have not completed execution). Is this correct, or what does this section tell us?

If useful, here is the front-end that I'm using in gdb, which is called gdb dashboard:

enter image description here

1
How did you get GDB to display that? Is that some front-end, or part of GDB's TUI mode? It's not part of the normal TUI layout reg display. But anyway, it looks like output from GDB's bt (backtrace) command. - Peter Cordes
@PeterCordes updated question with an example of it - samuelbrody1249
Ok, so that's a gdb-dashboard feature. Probably just showing you the output of bt or frame to compare. - Peter Cordes

1 Answers

1
votes

That is the call stack. GDB enables you to see the call stack, so you can understand how you got to where you are (Which function calls did you go through to get to where you are).

The call stack is the list of functions that have been called and not yet returned, beginning with the current function at frame 0, and going all the way down to main at the last frame.

In your particular case, your call stack is only main, because you've not called other functions (or because they returned already). %rip points to the current instruction, so your location in the current frame always corresponds to its contents.