I'm experiencing a weird inconsistency between the memory dump output I get from GDB's x command when dumping memory several KB into a complex C++ object. At the GDB prompt I get:
(gdb) x/32b 0x7FFFCD82B000
0x7fffcd82b000: 0xf8 0x23 0xae 0xf2 0xff 0x7f 0x00 0x00
0x7fffcd82b008: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x7fffcd82b010: 0xff 0xff 0xff 0xff 0x00 0x00 0x00 0x00
0x7fffcd82b018: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
And this corresponds to abnormal values of object members, e.g. bools with values other than 0 or 1. However, When dumping the content of this memory area from /proc/pid/mem I get 0 in the first 8 bytes and then the same memory content as above (the left column is the memory offset in decimal):
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 f8
9 23
10 ae
11 f2
12 ff
13 7f
14 0
15 0
16 0
17 0
18 0
19 0
20 0
21 0
22 0
23 0
24 30
25 21
26 4c
27 f4
28 ff
29 7f
30 0
31 0
I'm using GDB 7.7.1 on Linux 3.13 (Unbuntu 14.04). My code is C++ 11 and I compile using g++ 4.8.2 that came with the system.
The Python script I used to dump the content of /proc/.../mem shown above:
fp = open('/proc/24821/mem', 'r')
fp.seek(0x7fffed82b000)
r = fp.read(32)
for n, c in enumerate(r): print '%2d' % n, '%2x' % ord(c)
Any help will be greatly appreciated!
Aucun commentaire:
Enregistrer un commentaire