Search code examples
assemblygccx86gdbstack-pointer

Why is value of RSP higher than RBP as displayed in GDB?


I am inspecting a process (which has no bugs actually) with gdb.

However I noticed, when doing info registers, that RSP is higher than RBP, which is not consistent with the fact that the stack grows downwards. Is this perhaps some optimization by the compiler?

rbp            0x7fabaf9ba290      0x7fabaf9ba290
rsp            0x7ffdf1ffa1b0      0x7ffdf1ffa1b0

Solution

  • There's no requirement that rbp be used as a frame pointer. When -fomit-frame-pointer is active, as is the default in optimized programs, it's just used the same as any other call-saved register (e.g., rbx).