Gdb Print Hex Array in Single Byte Mode

Gdb Print Hex Array in Single Byte Mode

I'm using x/20x to print binary data in gdb

(gdb) x/20x 0x555555558df0
0x555555558df0: 0xfa1e0ff3  0x56415741  0x54415541  0x55fc8941

I wanted to print it in single byte like this:

0xf3 0x0f 0x1e 0xfa 0x41 0x57 0x41 0x56 ...

Is that possible?

EDIT

I've tried xb command as j6 suggested, but how can I print all of them in a single line?

(gdb) x/20xb 0x00007ffff7e84000
0x7ffff7e84000 <opendir>:   0xf3    0x0f    0x1e    0xfa    0x41    0x55    0x41    0x54
0x7ffff7e84008 <opendir+8>: 0x55    0x53    0x48    0x81    0xec    0xa8    0x00    0x00
0x7ffff7e84010 <opendir+16>:    0x00    0x64    0x48    0x8b
4

1 Answer

Try format xb, which is format x (hex), size b (bytes):

(gdb) x /8xb argv
0x7fffffffdc88: 0x20    0xe1    0xff    0xff    0xff    0x7f    0x00    0x00

help x is your friend.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.