I am trying to get a formatted print of a long 2D array, of width 8, of floats. When using the x
command, I get the array printed as four-column table:
(gdb) x/16f 0x81000000
0x81000000: 0 0 1 0
0x81000010: 2 0 3 0
0x81000020: 4 0 5 0
0x81000030: 6 0 7 0
When using the p
command, I get an unformatted output, the width of the terminal:
(gdb) p/f *(0x81000000)@16
$27 = {0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0}
Required output, something like:
(gdb) x/16f 0x81000000
0x81000000: 0 0 1 0 2 0 3 0
0x81000020: 4 0 5 0 6 0 7 0
or:
(gdb) p/f *(0x81000000)@16
$27 = {0, 0, 1, 0, 2, 0, 3, 0,
4, 0, 5, 0, 6, 0, 7, 0}
Is there a simple way to format the output for a specific width?