C/GDB: display contents of address

21,008

If you know the type of the structure at that address, you can coerce GDB to print it with:

(gdb) print *(struct mystruct *) 0x8002bf20

If you do not know the type of the structure, then the best you can do is the x command which you already mentioned -- although do be aware that there's no harm in casting to the 'wrong' type, so you can try various structures with print *(struct mystruct *) until the output looks plausible.

Share:
21,008
JDS
Author by

JDS

Updated on February 28, 2020

Comments

  • JDS
    JDS about 4 years

    I have this address, 0x8002bf20, and I need to see what's inside there. I know GDB does nice things like "print x" and I'll see something like struct ex {x: 1, y: 2}

    I need to see that kind of print output for this address I need to examine.

    Thanks.