Jason Blog

GDB 編譯&安裝

ftp://sourceware.org/pub/gdb/releases/
tar xfv gdb-7.8.1.tar.gz
cd gdb-7.8.1
./configure
make -j8
sudo ake install
gdb 會出現  'g' packet reply is too long:

###修改gdb/remote.c文件,屏蔽process_g_packet函数中的下列两行:
if (buf_len > 2 * rsa->sizeof_g_packet)
    error (_(Remote g packet reply is too long: %s), rs->buf);
在其后添加:
if (buf_len > 2 * rsa->sizeof_g_packet) {
      rsa->sizeof_g_packet = buf_len ;
      for (i = 0; i < gdbarch_num_regs (gdbarch); i++) {
         if (rsa->regs[i].pnum == -1)
         continue;

         if (rsa->regs[i].offset >= rsa->sizeof_g_packet)
         rsa->regs[i].in_g_packet = 0;
         else
         rsa->regs[i].in_g_packet = 1;
      }
}

gdb