打印内存地址格式有变化吗

时间:2015-04-12 19:24:37

标签: gdb

今天,当我想从内存地址打印8个字节时,我输入并收到以下


(gdb) x/8x 0x55683298
0x55683298 <_reserved+1036952>: 0xa8 0x32 0x68 0x55 0xec 0x73 0xfc 0xf7

上个月,如果我要完成相同的打印命令,我会收到不同的打印格式。

0x55683298 <_reserved+1036952>: 0x556832a8 0xf7fc73ec

如何恢复原有的打印格式?还有,为什么它改变了?

1 个答案:

答案 0 :(得分:3)

  

如何恢复原有的打印格式?

(gdb) x/wx 0x55683298

(gdb) help x
Examine memory: x/FMT ADDRESS.
ADDRESS is an expression for the memory address to examine.
FMT is a repeat count followed by a format letter and a size letter.
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),
  t(binary), f(float), a(address), i(instruction), c(char), s(string)
  and z(hex, zero padded on the left).
Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).
The specified number of objects of the specified size are printed
according to the format.

Defaults for format and size letters are those previously used.
Default count is 1.  Default address is following last thing printed
with this command or "print".

请特别注意“以前使用过的”部分:

(gdb) x/x &main
0x4004ed <main>:    0xe5894855
(gdb) x/c &main
0x4004ed <main>:    85 'U'
(gdb) x/x &main
0x4004ed <main>:    0x55   <<=== new default is 'c'!