关于采用eclipse调试linux内核,网上教程很多,这里就不详述了,具体参见《
Eclipse CDT + QEMU 调试linux内核》http://www.cnblogs.com/chinacloud/archive/2011/07/21/2112491.html。
由于上面的文档完成时间较早,适用于比较早一点的eclipse,而对于eclipse 3.7版本,有一些不一样,主要是设置调试选项时,不是在C/C++ Application中设置,而是在C/C++ Remote Application中设置,设置方法基本一致,不详述。
设置好以后,按照文档说明进行调试,看现象似乎是没有在start_kernel处断住,网上查找解决方法,文章很少,唯一找到一篇,说是新版eclipse的问题。没办法,试试吧,找了3.6版本的eclipse,设置完全按照文档描述的来进行,调试,现象一样,郁闷,开始怀疑自己的选择了,折腾了大半天,居然还是回到起点。
开始怀疑是因为gdb出错了,于是在console中查找出错信息,比较顺利,果然是gdb执行出错了,所以无法进入调试模式:
324,947 (gdb)
324,948 10-exec-continue
324,949 9^done,threads=[{id="1",target-id="Thread 1",details="CPU#0 [running]",frame={level="0",addr\
="0x0000000000000000",func="??",args=[]},state="stopped"}]
324,949 (gdb)
324,949 10^running
324,949 *running,thread-id="all"
324,949 (gdb)
329,618 10^error,msg="Remote 'g' packet reply is too long: 00000000000000000000cd0100000000000000000\
00000008071b181ffffffff00000001000000006871b181ffffffff781fa081ffffffff601fa081ffffffff0000000000000\
00000001000000000000000000000000000000c06000000000020000000000000000070b881ffffffffa81fa081ffffffff5\
045010000000000f577ac81ffffffff920000001000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000007f030000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000801f0000"
329,619 (gdb)
c
编译完成后,修改eclipse的gdb配置,修改为自己编译的gdb,重新调试,OK,源码调试正式开始,F5/F6/F7不亦乐乎。
折腾了我一天一晚的问题,没想到其实如此简单;不过终究是解决了,也算是有收获。
阅读(4531) | 评论(0) | 转发(0) |