这种情况需要修改一下GDB的源代码,由于优先级为先解决这个问题,详细的原因就暂时先不去跟踪。要修改的代码文件为gdb/remote.c,修改的diff如下:
1 --- remote.c 2013-05-11 18:24:18.000000000 +0800
2 +++ remote.c 2013-05-11 18:32:35.000000000 +0800
3 @@ -5958,7 +5958,19 @@
4
5 /* Further sanity checks, with knowledge of the architecture. */
6 if (buf_len > 2 * rsa->sizeof_g_packet)
7 - error (_("Remote 'g' packet reply is too long: %s"), rs->buf);
8 + {
9 + rsa->sizeof_g_packet = buf_len;
10 + for( i=0; i<gdbarch_num_regs(gdbarch); ++i)
11 + {
12 + if(rsa->regs->pnum == -1)
13 + continue;
14 + if(rsa->regs->offset >= rsa->sizeof_g_packet)
15 + rsa->regs->in_g_packet = 0;
16 + else
17 + rsa->regs->in_g_packet = 1;
18 + }
19 + //error (_("Remote 'g' packet reply is too long: %s"), rs->buf);
20 + }
21
22 /* Save the size of the packet sent to us by the target. It is used
23 as a heuristic when determining the max size of packets that the
修改完重新编译gdb,再使用target remote来连接入qemu就OK。但在AMD64的环境下,Qemu的软件中断和硬件中断全部失效。但是可以断点在FreeBSD内核启动的mi_startup位置。不得解中。 不能设置断点的问题,通过更新qemu-devel版本(qemu1.4.1)就可以解决。