Qemu+Gdb debug linux kernel

Use Qemu and Gdb debug the kernel

Author: wugsh15
Review:
Date: 2015-12-18
Expires: 2015-12-18
Keywords: qemu gdb kernel
Ref: http://blog.csdn.net/silangquan/article/details/9090915   http://www.jianshu.com/p/6d3ae604b4cf


1. Ready to work : apt-get install vim cscope exuberant-ctags build-essential qemu

2. Download linux kernel and compiling it, when "make menuconfig" you must selected the options "Compile the kernel with debug info" and "Compile the kernel with frame pointers" in the project of "Kernel hacking" and usethe command " make -j* bzImage" compiling the kernel. * means the number of cores.

3. In the terminal use the command "qemu -S -kernel /arch/x86/boot/bzImage" start qemu. Then use "ctrl+alt+2" jump the console panel of qemu in the qemu's panel input the command "gdbserver tcp::1234" meaning that start gdbserver and monitor the port(1234) of tcp.

4. Open a new terminal input "gdb":
       (gdb)file vmlinux    # loading the symbol table.
       (gdb)target remote:1234    # building the link between gdb and gdbserver.
       (gdb)break start_kernel    # set a breakpoint at start_kernel int the kernel.
       (gdb)c            #continue the program.

5. If you want to view other functions, you can do like the step of 4.
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值