LOGBOOK

HELP

Quiz Entry - updated: 2026.07.06

How does endianness affect what you see in GDB memory dumps?

x86 is little-endian — the least significant byte sits at the lowest address — but x/ with a word/giant size reassembles the value for you; only raw x/xb byte dumps show the reversed order.

0x04030201 stored little-endian puts 0x01 at the lowest address; x/xw reassembles it as 0x04030201 while x/4xb shows the raw reversed byte order 01 02 03 04.

* Little-endian: LSB at lowest address; x/xw reassembles, x/xb shows raw bytes. *

Example: The integer 0x04030201 in memory:

Address: 0x00  0x01  0x02  0x03
Content: 0x01  0x02  0x03  0x04  (LSB first)

GDB handles it for you:

# Shows "correctly" as 0x04030201
(gdb) x/xw 0x7fffffffe000
0x04030201

# Shows raw bytes (reversed from how you'd write the number)
(gdb) x/4xb 0x7fffffffe000
0x01  0x02  0x03  0x04

When it matters:

  • Examining strings: No effect (strings are byte sequences, order preserved)
  • Examining integers: x/xw shows the "correct" value; x/xb shows raw byte order
  • Examining addresses: Use x/a or x/xg — GDB handles endianness

Forensic trap: If you dump memory as raw bytes and try to read addresses manually, remember to reverse each group of 8 bytes.

Go deeper:

From Quiz: REVE1 / Assembly Patterns & GDB | Updated: Jul 06, 2026