天下网吧 >> 网吧方案 >> 网络方案 >> 正文

技术共享——Cisco IOS进程调试

  read mem    mAA..AA,LLLL  AA..AA is address, LLLL is length.
  write mem    MAA..AA,LLLL:XX..XX
  AA..AA is address,
  LLLL is number of bytes,
  XX..XX is data
  continue    cAA.AA    AA..AA is address to resume
  IF AA..AA is omitted
  resume at same address.
  step      sAA..AA    AA..AA is address to resume
  If AA..AA is omitted,
  resume at same address.
  
  kill request    k
  last signal    ?    Reply the current reason for stopping.
  This is the same reply as is generated
  for step or cont : SAA where AA is the
  signal number.
  toggle debug    d    toggle debug flag (see 386 & 68k stubs)
  
  All other commands will be ignored... too bad 'search' isn't implemented.
  
  The protocol is simple, quoting remote.c comments:
  
  A debug packet whose contents are <data> is encapsulated for transmission in the form.
  $ <data> # CSUM1 CSUM2
  
  <data> must be ASCII alphanumeric and cannot include characters
  '$' or '#'. If <data> starts with two characters followed by
  ':', then the existing stubs interpret this as a sequence number.
  
  CSUM1 and CSUM2 are ascii hex representation of an 8-bit checksum of <data>, the most significant nibble is sent first.
  the hex digits 0-9,a-f are used.
  
  Before trying to make gdb work i wrote a little program that computed the right checksum:
  
  #include <stdio.h>
  unsigned char const hexchars[] = "0123456789abcdef";
  char tohexchar (unsigned char c)
  {
  c &= 0x0f;
  return(hexchars[c]);
  }
  
  int main(int argc, char **argv)
  {
  unsigned char checksum;
  int count;
  char *command;
  char ch;
  if (argc <= 1)
  exit(1);
  printf("gdb protocol command: ");
  command = argv[1];
  putchar ('$');
  checksum = count = 0;
  while ((ch = command[count]))
  {
  putchar(ch);
  checksum += ch;
  count++;
  }
  putchar('#');
  putchar(tohexchar(checksum >> 4));
  putchar(tohexchar(checksum));
  putchar(' ');
  }
  
  ./gdbproto g
  gdb protocol command: $g#67
  
  now paste that on the |||| prompt and you get register output:
  sce

本文来源:天下网吧 作者:网吧方案

相关文章
没有相关文章
声明
声明:本站所发表的文章、评论及图片仅代表作者本人观点,与本站立场无关。若文章侵犯了您的相关权益,请及时与我们联系,我们会及时处理,感谢您对本站的支持!联系Email:support@txwb.com,系统开号,技术支持,服务联系QQ:1175525021本站所有有注明来源为天下网吧或天下网吧论坛的原创作品,各位转载时请注明来源链接!
天下网吧·网吧天下