Qemu 调试内核 出错 Remote 'g' packet reply is too long:
按照博客http://blog.csdn.net/sunnybeike/article/details/6648815Qemu 调试内核,
qemu的启动方式如下,
qemu-system-x86_64 -kernel bzImage -hda linux-0.2.img -append "root=/dev/hda" -S
在弹出的qemu中,按住Ctrl+Alt+2,进入Qemu控制端,然后输入 gdbserver
然后,另起一个端口,输入
gdb vmlinux
出现如下错误:
尝试了不同版本的Qemu和gdb,但是都没有解决问题,实际上是gdb出现问题了。
这篇文章(http://www.yonch.com/tech/84-debugging-the-linux-kernel-with-qemu-and-eclipse)解释了原因,
“Note that other tutorials also add a "-S" parameter so QEMU starts the kernel stopped, however this is ommitted deliberately. The "-S" parameter would allow gdb to set an initial breakpoint anywhere in the kernel before kernel execution begins. Unfortunately, a change made to the gdbserver in QEMU, to support debugging 32- and 16-bit guest code in an x86_64 session breaks the -S functionality. The symptoms are that gdb prints out "Remote 'g' packet reply is too long:", and fails to interact successfully with QEMU. The suggested fix is to run the QEMU until it is in 64-bit code (i.e. after the boot loader has finished and the kernel started) before connecting from gdb (omitting the -S parameter). To debug a running kernel, this is sufficient; it is the method we will take.”
但是它的解决方案我没有尝试,
我尝试了这篇文章(http://augustl.com/blog/2014/gdb_progress/)的解决方案,即在gdb开始后,指定体系结构,按照如下方式:
但是失败了。想来,在启动qemu的时候就是用的qemu-system-x86_64,已经指定了要模拟的CPU,再在GDB中指定,是不是多次依据,看来这个也不是解决方案。。
真正的解决方案参考http://blog.sina.com.cn/s/blog_8709e3120101gst1.html,需要修改gdb源码,修改方式如下。主要就是修改buf_len > 2*rsa->sizeof_g_packet时,gdb的处理方式。注意,我用的是7.8内核,所以修改的源码和这篇博客(http://blog.sina.com.cn/s/blog_8709e3120101gst1.html)不太一样,它用的7.5内核。所以,请留意。不过,其实只是结构体变量引用方式的不同。
ps:我的qemu用的是2.1.2,gdb用的是7.8,linux是2.6.31.4
祝各位好运!
Qemu 调试内核 出错 Remote 'g' packet reply is too long:相关推荐
- Remote 'g' packet reply is too long 错误
在 用 kgdb 调试64位arm内核的时候,当一切准备停当,在aarch64-linux-gnu-gdb 下输入 target remote /dev/ttyUSB0 后,gdb报出Remote ' ...
- 通过qemu调试centos7内核
1.安装依赖 sed -e 's|^mirrorlist=|#mirrorlist=|g' \-e 's|^#baseurl=http://mirror.centos.org|baseurl=http ...
- qemu debug linux内核,qemu调试linux内核
2012.03.19 网上时间过早的讲编译内核的文章完全不用看,比如什么讲kgdb的,现在这个东西早就被集成到内核里了.还有调试内核的一些允许kernel debugging的选项,在新版本中也早已是 ...
- Eclipse CDT+Qemu调试Linux 0.11内核
操作系统:CentOS 6.3 for 32bit 需要软件:eclipse-cpp-galileo-SR2-linux-gtk.tar.gz qemu 需要内核文件:linux 0.11(Makef ...
- qemu+gdb调试内核
我们在内核调试的时候,会有很多方法,比如printk, ftrace, kprobe, ebpf和gdb等.比起其他的方法,gdb可以单步运行代码,实时获取变量信息等优势.但劣势也比较明显,比如效率较 ...
- linux 内核编译需要多大空间,编译2.6.28内核出错。。。。空间不足。而/tmp/还有好几G...
编译2.6.28内核出错....空间不足.而/tmp/还有好几G 发布时间:2009-01-02 16:56:47来源:红联作者:weixq316 今天闲来无事,就去下载了最新的内核--2.6.28来 ...
- linux filesystem_如何使用cgdb + qemu调试linux内核模块
如何使用cgdb + qemu调试linux内核模块 前言 Linux 代码庞大而繁杂,光看代码会使人头晕目眩,如果能通过调试工具对其代码执行流程进行调试,则对学习Linux kernel以及解决平时 ...
- gdb 调试kvm虚拟机_GDB+QEMU调试内核模块(实践篇)
调试内核模块的方法有很多.最常用的,可能也是上手难度最低的就是使用prinfk打印出相关的调试信息,但是总给人的感觉不够geeek,所以这里描述一种能够使用gdb+qemu来调试内核的方法. 启动虚拟 ...
- Windows驱动开发学习笔记(二)—— 驱动调试内核编程基础
Windows驱动开发学习笔记(二)-- 驱动调试&内核编程基础 基础知识 驱动调试 PDB(Program Debug Database) WinDbg 加载 PDB 实验:调试 .sys ...
最新文章
- 程序员的“凡尔赛文学”大赏!
- day15-JavaScript字符串操作以及跑马灯示例
- ASP.NET 如何动态修改 title Meta link标签
- 【转载】机器学习领域的大家
- 【网络安全】针对 HTTP/2 协议的HTTP Desync攻击
- 完成端口(Completion Port)详解----- By PiggyXP(小猪)
- 《像计算机科学家一样思考Python》——4.4 封装
- 李航《统计学习方法》第二章课后答案链接
- python中文显示不出来_Python查询数据库,中文的结果显示不出来
- mysql 修改密码_经验总结 | MYSQL修改密码脚本,值得收藏
- Excel学习笔记:P22-时间格式、工龄与工时计算
- CF 1260 D 题解
- win10开机黑屏时间长或只有鼠标解决办法,亲测可用
- 智慧医疗管理系统解决方案:医药电商系统实现智能化改造
- 如何判断网站SSL证书是否安装成功?
- Python3 面向对象编程
- 【Android】关于statusbar的处理
- android模拟打印机服务,Android下的POS打印机调用的简单实现
- 51信用卡股价年初至今上浮5倍,引入银行背景高管担任行政总裁
- 1400. 构造 K 个回文字符串