Read From Memory Using GDB

Use the following format: x/nfu addr, where:

  • x - the "examine" command
  • n - the repeat count
  • f - the display format, e.g:
    • x - hexadecimal
    • z - hexadecimal, with preceeding zeroes to pad to type's size
    • d - decimal (signed)
    • u - decimal (unsigned)
    • o - octal
    • t - binary
    • a - address (hex, and as offset from closes preceeding symbol)... see also info symbol addr
    • c - character
    • f - float
    • s - string / char *
    • i - instruction
    • r - raw - bypasses python pretty-printer... unknown use
  • u - unit size
    • b - 8-bit / byte
    • h - 16-bit / half word (two bytes)
    • w - 32-bit / word (four bytes)
    • g - 64-bit / giant word (eight bytes)
  • addr - starting address

Example

  • x/64xb 0x50001000 - 64 bytes from address 0x50001000, printed as hexadecimal
  • x/5i $pc - 5 instructions from the program counter

See Also