With the following assembly:
mov $2, %rax
push %rcx
call func
The 'stack' section in gdb looks like this:
─── Stack ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[0] from 0x0000000000400109 in func
[1] from 0x00000000004000be in _start
And it doesn't matter whether I add or remove the push %rcx instruction. Why does gdb only show the 'function address stack', and not show any modifications to the stack when manually pushed? That is, both push %rcx and call func change the stack register rsp but only the latter actually changes what gdb shows in the "stack" section.
Could someone please explain the reason for this?
x/8x $rsp- Jestercalland which are frompush, for hand-written asm without debug info? I'd guess it might look for possible return addresses, i.e. values that point into the text section? Or maybe the OP isn't showing us a complete enough full picture. - Peter Cordes