gdb小帮手

在LINUX下干活基本不要指望着像在WIN下干活那么舒服。

不同的版本和不同的库都可能会引起各种不同的错误现象。一定要有心理准备。

(gdb) p *pid
$15 = {id = 7, feature_offset = -1, feature = "&usr=", '\000' <repeats 24 times>, feature_len = 0,
  type = 0 '\000', result_offset = 4, result_len = 32, proto_no = 1,
  fill_fileld = 0x4080b4 <fill_fileld_str>, end_mark = "&", '\000' <repeats 28 times>, ext = 0x0}
(gdb) set print pretty on   //
(gdb) p *pid
$16 = {
  id = 7,
  feature_offset = -1,
  feature = "&usr=", '\000' <repeats 24 times>,
  feature_len = 0,
  type = 0 '\000',
  result_offset = 4,
  result_len = 32,
  proto_no = 1,
  fill_fileld = 0x4080b4 <fill_fileld_str>,
  end_mark = "&", '\000' <repeats 28 times>,
  ext = 0x0
}

-g      //添加调试功能

-Wall     //添加编译打印

(gdb) p /x * buf@803
$4 = {0x3, 0x23, 0x0, 0xa, 0xb, 0x31, 0x37, 0x33, 0x32, 0x65, 0x62, 0x38, 0x31, 0x65, 0x34, 0x61, 0x31, 0x63, 0x37, 0x34, 0x0,
  0xff <repeats 33 times>, 0x1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0xff <repeats 46 times>,
  0x69, 0x0, 0x0, 0x1, 0x48, 0xa5, 0x8e, 0x83, 0x2a, 0x0, 0x0, 0x1, 0x48, 0xa5, 0x8e, 0x83, 0x2a, 0x0, 0xa, 0x0, 0x0, 0x1, 0x53,
  0x0, 0x0, 0x3b, 0x40, 0xa1, 0xe4, 0xff <repeats 16 times>, 0xc, 0x87, 0x0, 0x7b, 0x7d, 0x32, 0x17, 0xff <repeats 16 times>,
  0x0, 0x6e, 0x0, 0x0, 0x0, 0x8b, 0x0, 0x0, 0x6, 0x48, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x2, 0x0 <repeats 42 times>, 0xff,
  0xa8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0xff <repeats 164 times>, 0x0, 0x0, 0x0, 0x0, 0xff <repeats 384 times>, 0x1}
(gdb) p /x *(buf+250)@2
$5 = {0xff, 0xff}
(gdb) p /x *(buf+250)@553
$6 = {0xff <repeats 164 times>, 0x0, 0x0, 0x0, 0x0, 0xff <repeats 384 times>, 0x1}

posted on 2014-08-21 10:45  七层模型  阅读(197)  评论(0)    收藏  举报

导航