gdb的阅读顺序,把32个bit/4个Bytes/1 word作为一个显示单元。每行显示4个Word/128bit/16个bytes。这样第一列的地址可以按照16bytes的地址做偏移。(1~F)

x/20 puc
0x7ffeb6f45f20:    0x00002601    0x00000000    0x00000000    0x00000000
0x7ffeb6f45f30:    0x6c6c6568    0x0000006f    0xf65e2500    0xbb846972
0x7ffeb6f45f40:    0xb6f46030    0x00007ffe    0x00000000    0x00000000
0x7ffeb6f45f50:    0x00406e60    0x00000000    0xf4226830    0x00007f5d

内存的阅读顺序反过来。

01 26 00 00 00 00 00 00

   unsigned char puc[4];

struct tagPIM
{

 unsigned char pim;
 unsigned char pim1:1;
 unsigned char pim2:2;
 unsigned char pim3:3;

}*pstPimData;

pstPimData = (struct tagPIM *)puc;
memset(puc,0,4);
pstPimData->pim = 1;
pstPimData->pim1 = 2;
pstPimData->pim2 = 3;
pstPimData->pim3 = 4;

printf("%02x %02x %02x %02x n", puc[0],puc[1],puc[2],puc[3]);

标签: none

添加新评论