GDB: examine IP addresses
Reading IP fields in C structs is not practical when debugging with GDB.
I usually don't remember the syntax, here it is:
(gdb) x/4ub &ipv4 0x7fffffffdccc: 203 0 113 1 (gdb) x/8xh &ipv6 0x7fffffffdcd0: 0x2001 0x0db8 0x0000 0x0000 0x0000 0x0000 0x0000 0x0001
These commands will:
examine 4 bytes of memory at address (&ipv4) and represent in decimal,
examine 8 half-words of memory at address (&ipv6) and represent in hexadecimal.