如果你用qemu调试代码遇到了Remote 'g' packet reply is too long: ...错误,两种可行的解决方案如下:
解决方案一:再次连接
- 启动gdb连接qemu的方法如下:
> gdb
set arch i386:x86-64:intel
target remote localhost:1234
symbol-file YOUR_KERNEL_FILE
break SOME_FUNCTION_IN_LONG_MODE
continue
- 当出现Remote 'g' packet reply is too long错误后,执行如下命令:
disconnect
set arch i386:x86-64
target remote localhost:1234
- 注意:第二次执行set命令参数和第一次不同,没有intel
解决方案二:修改gdb源码
- 注释掉gdb源码文件remote.c中如下代码:
error (_("Remote 'g' packet reply is too long: %s"), rs->buf);
重新编译gdb即可