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

前端 未结 2 2071
有刺的猬
有刺的猬 2020-12-20 22:37

This is the display of my gdb

(gdb) x/20bx 0xbffff2c0
0xbffff2c0: 0xd4    0xf2    0xff    0xbf    0x16    0x8f    0x04    0x08
0xbffff2c8: 0x05          


        
相关标签:
2条回答
  • 2020-12-20 23:14

    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.

    0 讨论(0)
  • 2020-12-20 23:16

    Use x/20wx

    (gdb) x/20bx &result
    0x7fff5fbff5f4: 0xff    0x7f    0x00    0x00    0x5e    0x10    0xc0    0x5f
    0x7fff5fbff5fc: 0xff    0x7f    0x00    0x00    0x10    0xf6    0xbf    0x5f
    0x7fff5fbff604: 0xff    0x7f    0x00    0x00
    
    (gdb) x/20wx &result
    0x7fff5fbff5f4: 0x00007fff  0x5fc0105e  0x00007fff  0x5fbff610
    0x7fff5fbff604: 0x00007fff  0x8994d5fd  0x00007fff  0x00000000
    0x7fff5fbff614: 0x00000000  0x00000001  0x00000000  0x5fbff7e8
    0x7fff5fbff624: 0x00007fff  0x00000000  0x00000000  0x5fbff804
    0x7fff5fbff634: 0x00007fff  0x5fbff830  0x00007fff  0x5fbff847
    
    0 讨论(0)
提交回复
热议问题