一、简介
kgdb是一种源码级的Linux内核调试器。使用kgdb调试内核时,需要结合gdb一起使用,使用他们可以对内核进行单步调试,设置断点,观察变量、寄存器的值等与应用调试相关的功能。然而也有其限制条件,将在接下来kgdb调试器原理来讲述,本文仅简单介绍使用Kgbd的流程。
https://kgdb.wiki.kernel.org/index.php/Main_Page
二、安装配置
1)打开kgdb与kdb配置选项,重新编译内核
https://www.kernel.org/pub/linux/kernel/people/jwessel/kdb/CompilingAKernel.html#CompileKGDB
http://blog.chinaunix.net/uid-27717694-id4051339.html
http://www.cnblogs.com/274914765qq/p/4978999.html
2)启动项设置,分别对server和client的启动文件:/boot/grub/grub.conf,做如下修改
server:
kgdboc=ttyS1,115200
client:
kgdboc=ttyS1,115200 kgdbwait
3)串口设置
http://www.goupteam.com/tech-expand/1259.html
https://www.vmware.com/support/ws5/doc/ws_devices_serial_2vms.html
三、使用实例
1)内核调试
http://blog.chinaunix.net/uid-20672257-id-2936794.html
2)模块调试
http://blog.chinaunix.net/uid-20672257-id-2936794.html
四、常见问题
1)kdb与kgdb模式相互切换
http://www.zeuux.com/blog/content/3736/
参考:http://blog.chinaunix.net/uid-25538637-id-261329.html
http://www.linuxidc.com/Linux/2013-06/86233.htm
原标题:Linux kgdb命令
关键词:linux