In gdb it is possible to show let's say 5 last values on the stack via:
(gdb) x/5x $sp
0x7fffffffde40: 0x00000001 0x00000000 0xffffe1e9 0x00007fff
0x7fffffffde50: 0x00000000
as explained here. However I would like to add it to auto display and was not able to come up with a solution. My try so far yields only the address of the last element on the stack:
(gdb) display/5x $sp
1: /x $sp = 0x7fffffffde40
as display
seems just to skip 5
.
Is is possible to show the content of the stack in the auto display?