gpt4 book ai didi

assembly - gdb 无法从字符串地址访问内存

转载 作者:行者123 更新时间:2023-12-05 08:01:44 27 4
gpt4 key购买 nike

我用以下变量编译了一个汇编程序:

.data
x: .long 1337
str: .string "Hallo Welt\n"

在 gdb 中,我想使用带有 str 地址的 examine 命令。

(gdb) x str
0x6c6c6148: Cannot access memory at address 0x6c6c6148

我不明白为什么它不起作用。

最佳答案

0x6c6c6148 是“Hall”,因此 gdb 试图将字符串内容解释为地址。来自 the manual :

addr, starting display address
addr is the address where you want GDB to begin displaying memory. The expression need not have a pointer value (though it may); it is always interpreted as an integer address of a byte of memory.

试试 x/s &str,它可能会更好。

关于assembly - gdb 无法从字符串地址访问内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12707087/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com