我在运行堆栈跟踪时遇到问题:
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
我在网上找到this文章可能有所帮助。但是,我不知道这个人怎么知道哪些报告指针所在的指针。这是我在x / 64x $ sp命令中的输出:
(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
有没有一种简单的方法来学习哪些指针是帧指针?
我不知道这个人怎么知道哪些报告指针指向框架指针。
他猜到了。
鉴于你的$sp
是0xbee06598
,可能的候选人都是0xbee0...
。
注意:如果您的代码是由最近的GCC进行优化构建的,并且您没有提供-fno-omit-frame-pointer
,则可能根本没有帧指针。