(gdb) target remote:1234 Remote debugging using :1234 0x0000000000000000 in irq_stack_union () (gdb) hb start_kernel // 设置硬件断点 Hardware assisted breakpoint 1 at 0xffffffff81d9ae44: file init/main.c, line 489. (gdb) info b Num Type Disp Enb Address What 1 hw breakpoint keep y 0xffffffff81d9ae44 in start_kernel at init/main.c:489 breakpoint already hit 1 time (gdb) c Continuing.
Breakpoint 1, start_kernel () at init/main.c:489 489 {
8.1 gdb vmlinux会出现 “Remote ‘g’ packet reply is too long”错误
Remote 'g' packet reply is too long: 0000000000000000d981ffffffff00000004000000000000001006000000000000040000000000000010060000000000903fc081ffffffff883fc081ffffffff0000000000000000130000000000000000000000000000000cc5130300000000ffffffff00000000200000000000000020a1d981ffffffff8e0000000000000044aed981ffffffff8200000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000
解决办法: 修改gdb源码, 重新编译
1 2 3
wget ftp://sourceware.org/pub/gdb/releases/gdb-7.6.tar.gz tar -xvf gdb-7.6.tar.gz cd gdb-7.6
注释掉:
1 2
if (buf_len > 2 * rsa->sizeof_g_packet) error (_(“Remote ‘g’ packet reply is too long: %s”), rs->buf);
并在后面添加:
1 2 3 4 5 6 7 8 9 10 11 12
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;