examine(简写是x)可以查看内存地址中的值。
(gdb) help x
Examine memory: x/FMT ADDRESS.
(x/(n/f/u) addr)
ADDRESS is an expression for the memory address to examine.
FMT is a repeat count(n) followed by a format letter(f) and a size letter(u).
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),
t(binary), f(float), a(address), i(instruction), c(char) and s(string).
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”.
说明:
1. n和u:n表示显示的单元数,如字符数字;u表示每个单元所占的字节数,如读取字符则设为b,整型数字则为w
2. f和u默认使用之前的设置
3. 实战:
x/5cb str #从str指针开始,显示5个字节
x/1sb str #显示字符串str,也可使用print str显示
x/4dw arr #从arr指针开始,取4个整型数字以十进制格式显示