這種情況需要修改一下GDB的源代碼,由于優(yōu)先級為先解決這個問題,詳細的原因就暫時先不去跟蹤。要修改的代碼文件為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的環(huán)境下,Qemu的軟件中斷和硬件中斷全部失效。但是可以斷點在FreeBSD內(nèi)核啟動的mi_startup位置。不得解中。 不能設置斷點的問題,通過更新qemu-devel版本(qemu1.4.1)就可以解決。