GDB examine data display format from 8 bytes in a row to 4 bytes

gdb

Solution

`gdb` (at least in the 7.1 and 7.6 source I looked at) hard-wires the maximum number of elements per line that `x` will print, based on the format.

maxelts = 8;
if (size == 'w')
  maxelts = 4;
if (size == 'g')
  maxelts = 2;
if (format == 's' || format == 'i')
  maxelts = 1;

A workaround to get what you want is to type `x/4bx 0xbffff2c0` to print 4 elements and then type just enter to print each successive set of 4 elements.

Problem

This is the display of my `gdb` ``` (gdb) x/20bx 0xbffff2c0 0xbffff2c0: 0xd4 0xf2 0xff 0xbf 0x16 0x8f 0x04 0x08 0xbffff2c8: 0x05 0x00 0x00 0x00 0x00 0x00 0x0c 0x42 0xbffff2d0: 0x6b 0x00 0x00 0x00 ``` Is is possible to change it to 4 bytes in a row?

Original source