How to tell which pointers are the frame pointers from the GDB x/64x $sp command?

0

I am having a problem when running a stack trace:

Backtrace stopped: previous frame identical to this frame (corrupt stack?)

I found this article online that may help. However, I don't know how this person knew which of the reported pointers where the frame pointers. Here is my output from the x/64x $sp command:

(gdb) x/64x $sp
0xbee06598:     0x0000000b      0x009ce9a4      0x434e7d0f      0x42b48838
0xbee065a8:     0x00000000      0x00000006      0x0140c928      0x42b48838
0xbee065b8:     0xbee065dc      0x00108b5c      0x0140c920      0x0140c980
0xbee065c8:     0x009b4008      0x0140c928      0x00000064      0xbee06a50
0xbee065d8:     0xbee06654      0x0040c904      0x00c224b8      0x009ce9a4
0xbee065e8:     0x000000dc      0x0000000a      0x413e7000      0x00c224b8
0xbee065f8:     0xbee06634      0x4129e4e4      0x000000dc      0x000573aa
0xbee06608:     0x00c22160      0x000003e8      0x0b00000a      0x009ce9a4
0xbee06618:     0xf40dc000      0x40569106      0xd43d8000      0x4069cfa1
0xbee06628:     0x106f40dc      0x41112809      0x9f43a87b      0x41539a12
0xbee06638:     0x00000000      0x0140c920      0x00000000      0xbee06790
0xbee06648:     0x00000064      0xbee06a50      0xbee066fc      0x0075fdd0
0xbee06658:     0xbee0667c      0x41242734      0xbee06674      0x00c22160
0xbee06668:     0x000003e8      0x009c7470      0xbee0668c      0x0b00000a
0xbee06678:     0xbee0669c      0x41274a74      0x000003e8      0x00c22160
0xbee06688:     0xbee0669c      0x00c223c0      0x007a1250      0x009b1d68

Is there a simple way of learning which pointers are the frame pointers?

gdb
backtrace
asked on Stack Overflow Feb 27, 2019 by Rob • edited Feb 28, 2019 by Employed Russian

1 Answer

0

I don't know how this person knew which of the reported pointers where the frame pointers.

He guessed.

Given that your $sp is 0xbee06598, the likely candidates are all the 0xbee0... ones.

Note: if your code is built by a fairly recent GCC with optimization, and you didn't supply -fno-omit-frame-pointer, there may not be frame pointers at all.

answered on Stack Overflow Feb 28, 2019 by Employed Russian

User contributions licensed under CC BY-SA 3.0