当前位置: 动力学知识库 > 问答 > 编程问答 >

debugging - Ubuntu gdb can't access memory at address when tryint to view memory at $esp

问题描述:

Hi,

I am running ubuntu on VMWARE and when i try to access the memory at $esp,I get the error as shown in the screenshot below.I've tried googling for answers but most of them were too complicated.

Is there any configuration I need to do for this to work?

I've tried running gdb on my actual windows machine and it does not have this issue.

Thanks.

网友答案:

You want $rsp, not $esp.

By using $esp, you got the sign-extended 32-bit-truncated value of $rsp, which points to neverland.

Note: GDB provides $sp pseudo-register that is automatically mapped to correct stack pointer register for a given platform.

(gdb) p $rsp
$1 = (void *) 0x7fffffffe178
(gdb) p $sp
$2 = (void *) 0x7fffffffe178
(gdb) p $esp
$3 = -7816
(gdb) p/x $esp
$4 = 0xffffe178
分享给朋友:
您可能感兴趣的文章:
随机阅读: