更新时间:2023-02-01 17:47:09
GDB不知道您有一堆字符.您只是要求它查看一个内存位置,并显示那里的内容,默认为4字节整数.它假定该整数首先存储了最低有效字节,因为这是在Intel上完成的,因此您的字节反转了.
GDB doesn't know that you have a bunch of chars. You are just asking it to look at a memory location and it is displaying what is there, defaulting to a 4-byte integer. It assumes the integer is stored least significant byte first, because that is how it is done on Intel, so you get your bytes reversed.
要解决此问题,请在您的 x
命令中使用格式说明符,如下所示:
To fix this, use a format specifier with your x
command, like this:
x/10c 0x804a010
(将从0x804a010开始打印10个字符).
(will print 10 chars beginning at 0x804a010).
help x
将提供更多信息.