Reputation: 11268
I'm looking at unsigned char
(byte) arrays in gdb
, i.e.
(gdb) p/x buf@4
$76 = {0xac, 0xa, 0xb0, 0xa}
Is there a way of forcing the preceding 0s? i.e output like:
$76 = {0xac, 0x0a, 0xb0, 0x0a}
Upvotes: 1
Views: 804
Reputation: 52579
From the gdb documentation:
'z'
Like 'x' formatting, the value is treated as an integer and printed as hexadecimal, but leading zeros are printed to pad the value to the size of the integer type.
So...
(gdb) p/z buf@4
Upvotes: 5