When I try to see what's inside stack space, I use the following command:
x/100x $sp
However, sometimes output is formatted like this, grouping by 4 bytes:
0xbffff0ac: 0x00000000 0xb7fbc000 0xb7fbc000 0xbffff4e8
...
While sometimes I get this:
0xbffff0ac: 00 00 00 00 00 c0 fb b7 00 c0 fb b7 e8 f4 ff bf
But I can't determine how to switch between these formats and how gdb desides which format to use for output. Any suggestions?
x/100b <address>provides bytes,x/100s <address>provides shorts, etc. Also see questions like What does the gdb 'x' command do?, Formatting on gdb examine memory and GDB examine data display format from 8 bytes in a row to 4 bytes.