说明:
x 是 examine 的缩写
n表示要显示的内存单元的个数
f表示显示方式, 可取如下值
x 按十六进制格式显示变量。
d 按十进制格式显示变量。
u 按十进制格式显示无符号整型。
o 按八进制格式显示变量。
t 按二进制格式显示变量。
a 按十六进制格式显示变量。
i 指令地址格式
c 按字符格式显示变量。
f 按浮点数格式显示变量。
u表示一个地址单元的长度
b表示单字节,
h表示双字节,
w表示四字节,
g表示八字节
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)
举例
x/3uh buf
表示从内存地址buf读取内容,
h表示以双字节为一个单位,
3表示三个单位,
u表示按十进制显示
(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) 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".
(gdb) p f1 $4 = 8.25 (gdb) p f2 $5 = 125.5 (gdb) x/x &f1 0xbffff380: 0x41040000 (gdb) x/xw &f1 0xbffff380: 0x41040000 (gdb) x/xw &f2 0xbffff384: 0x42fb0000 (gdb) x/2xw &f1 0xbffff380: 0x41040000 0x42fb0000 (gdb) x/4xw &f1 0xbffff380: 0x41040000 0x42fb0000 0xbffff408 0x00bcba66 (gdb) x/tw &f1 0xbffff380: 01000001000001000000000000000000 (gdb) x/2tw &f1 0xbffff380: 01000001000001000000000000000000 01000010111110110000000000000000 (gdb) p record $10 = {12, 76, 48, 62, 94, 17, 32, 37, 52, 69} (gdb) p &record $11 = (int (*)[10]) 0x8049740 (gdb) x/4uw 0x8049740 0x8049740 <record>: 12 76 48 62 (gdb) x/6ow 0x8049740 0x8049740 <record>: 014 0114 060 076 0x8049750 <record+16>: 0136 021
|
阅读(1757) | 评论(0) | 转发(0) |