Reputation: 301
I'm trying to try all the variants of the x
command in assembly. I typed
(gdb) x /x $rsp
0x7fffffffdf90: 0x01
According to my book the x/x command select the first 8 bytes from rsp and write them as an hex. However, looking for the assembly documentation (gdb help) i have not found anywhere that the size of /x is explicitly 8 byte. So how do I know if it is really 8 bytes ?
Upvotes: 0
Views: 332
Reputation: 213935
So how do I know if it is really 8 bytes ?
It's not. It's "whatever size you used last". Documentation.
For example:
(gdb) x/bx $rsp
0x7fffffffcbc8: 0x1c
Subsequent x/x
commands will use size 1 (a single char):
(gdb) x/x $rsp
0x7fffffffcbc8: 0x1c
You can override the size explicitly:
(gdb) x/gx $rsp
0x7fffffffcbc8: 0x00007ffff7ddc61c
Subsequent x/x
commands now default to size 8:
(gdb) x/x $rsp
0x7fffffffcbc8: 0x00007ffff7ddc61c
Upvotes: 2