Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gdb print hex array in single byte mode

Tags:

gdb

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
like image 377
daisy Avatar asked Apr 17 '26 16:04

daisy


1 Answers

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.

like image 78
j6t Avatar answered Apr 21 '26 07:04

j6t



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!