2.16 在GDB里以C语言数组形式转储数据
http://scz.617.cn/unix/200905051651.txt
Q:
用gdb调试一个东西,没有源码,一般我用x命令查看内存,但有时需要以C语言数组 形式对指定地址转储指定长度的数据。
A: scz@nsfocus
(gdb) x/16br 0x629917D4 0x629917d4 B0 84 C4 4C 26 09 45 CE 1B 5C 56 28 F5 35 58 8D ...L&.E..\V(.5X. (gdb) set print array off (gdb) p/x (char)0x629917D4@16 $9 = {0xb0, 0x84, 0xc4, 0x4c, 0x26, 0x9, 0x45, 0xce, 0x1b, 0x5c, 0x56, 0x28, 0xf5, 0x35, 0x58, 0x8d} (gdb) set print array on (gdb) p/x (char)0x629917D4@16 $10 = {0xb0, 0x84, 0xc4, 0x4c, 0x26, 0x9, 0x45, 0xce, 0x1b, 0x5c, 0x56, 0x28, 0xf5, 0x35, 0x58, 0x8d} (gdb) set print array off (gdb) p/x *0x629917D4@4 $11 = {0xb084c44c, 0x260945ce, 0x1b5c5628, 0xf535588d}
其一般格式是:
p/x (type)array@num