Read From Memory Using GDB¶
Use the following format: x/nfu addr, where:
x- the "examine" commandn- the repeat countf- the display format, e.g:x- hexadecimalz- hexadecimal, with preceeding zeroes to pad to type's sized- decimal (signed)u- decimal (unsigned)o- octalt- binarya- address (hex, and as offset from closes preceeding symbol)... see alsoinfo symbol addrc- characterf- floats- string /char *i- instructionr- raw - bypasses python pretty-printer... unknown use
u- unit sizeb- 8-bit / byteh- 16-bit / half word (two bytes)w- 32-bit / word (four bytes)g- 64-bit / giant word (eight bytes)
addr- starting address
Tip
The same formats work for the print command too - for example p/x $pc.
Example¶
x/64xb 0x50001000- 64 bytes from address0x50001000, printed as hexadecimalx/5i $pc- 5 instructions from the program counter