(gdb) p it
$2 = (item *) 0x6
(gdb) p *it
$3 = {next = 0x0, prev = 0x0, h_next = 0x0, time = 0, exptime = 0, nbytes = 7, refcount = 1, nsuff开发者_JAVA技巧ix = 6 '\006', it_flags = 2 '\002', slabs_clsid = 1 '\001', nkey = 6 '\006',
end = 0x7f0890b6e040}
(gdb) p *0x6
Cannot access memory at address 0x6
Isn't p *it
and p *0x6
the same thing here??
Unless you are on an embedded target that has real memory mapped at address 0, the value of it
== 0x6
is bogus (usually result of a null pointer dereference).
The fact that gdb
prints *it
probably means there is a bug in gdb
, but it's hard to say. Unfortunately you didn't say which version of GDB, and what OS, you are using.
The gdb 'p' command can only be used for printing variables value. If you want to inspect memory have a look there
精彩评论