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

Time:11-29

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 ith the fact that the stack grows downwards. Is this perhaps some optimization by the compiler ?

rbp            0x7fabaf9ba290      0x7fabaf9ba290
rsp            0x7ffdf1ffa1b0      0x7ffdf1ffa1b0

CodePudding user response:

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).

  • Related