远程gdb调试不会停在断点处 [英] Remote gdb debugging does not stop at breakpoints

查看:388
本文介绍了远程gdb调试不会停在断点处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在调试修改后的Linux-3.11.0内核时遇到问题。
为了调试代码,我使用:


  1. GDB 7.6

  2. QEMU 1.6。 5

  3. Linux内核3.11.0

我的系统具有Intel(R)Core )运行Ubuntu 12.10的i7-2760QM CPU @ 2.40GHz我使用'make menuconfig'创建了一个配置文件来编译修改后的内核。 (在内核黑客类别中进行了修改)

一些.config文件行(我认为相关)在这里引用:

  CONFIG_DEBUG_INFO = y 
CONFIG_DEBUG_KERNEL = y
CONFIG_MAGIC_SYSRQ = y
CONFIG_DEBUG_FS = y
CONFIG_HAVE_HW_BREAKPOINT = y
CONFIG_HAVE_MIXED_BREAKPOINTS_REGS = y

我使用带-S选项的qemu来启动内核,使用gdb我连接到qemu并恢复执行:

 (gdb)目标远程:1234 
(gdb)继续

设置断点时,例如:
break schedule 我得到一个确认信息,例如:

 断点1在0xffffffff81736400:file kernel / sched / core。 c,2509行。

所以在这里一切似乎都好!



问题是gdb和qemu不会停在断点处!
他们只是继续运行......



我尝试按照某些地方的建议设置硬件断点,但是我收到消息:

 目标中没有硬件断点支持。 

这很奇怪,因为我设置了CONFIG_HAVE_HW_BREAKPOINT。



我也取消了 CONFIG_DEBUG_RODATA 的建议,但仍然没有结果...

试图用这里建议的.config文件搞乱: gdbserver里面qemu不停止在断点上,但我无法弄清楚.config文件和我的.config文件之间的相关区别......(有太多的不同!)

任何人都可以帮我吗?

谢谢!

解决方案

好的,我发现了这个问题,所以我在这里发布给其他人:
显然这是一个非常微妙的过程...我的配置文件很好。我只需要在连接到qemu之后定义断点,而不是在加载vmlinux之后定义断点。这些断点必须是硬件断点......否则它们不会中断!


I'm having problems with debugging my modified Linux-3.11.0 kernel. For debugging the code, I use:

  1. GDB 7.6
  2. QEMU 1.6.5
  3. Linux kernel 3.11.0

My system has Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz running Ubuntu 12.10

I compiled the modified kernel with a configuration file that I created using 'make menuconfig'. (with modifications in the "kernel hacking" category)

Some of the .config file lines (that I find relevant) are quoted here:

CONFIG_DEBUG_INFO=y 
CONFIG_DEBUG_KERNEL=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
CONFIG_HAVE_HW_BREAKPOINT=y
CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y

I use qemu with the "-S" option to boot my kernel, and using gdb I connect to qemu and resume it's execution:

(gdb) target remote :1234
(gdb) continue

When setting breakpoints, for an example: break schedule I get a confirmation message such as:

Breakpoint 1 at 0xffffffff81736400: file kernel/sched/core.c, line 2509.

So till here everything seems fine!

The problem is that gdb and qemu does not stop at the breakpoints! They both simply continue running...

I tried to set hardware breakpoints as suggested in some places, but I get the message:

No hardware breakpoint support in the target.

which is weird because I have the CONFIG_HAVE_HW_BREAKPOINT set.

I also unset CONFIG_DEBUG_RODATA as suggested in other places,but still no results...

I tried to mess around with the .config file as suggested here: gdbserver inside qemu does not stop on breakpoints but I couldn't figure out the relevant differences between the working .config file and my .config file... (There are too much differences!)

Can anyone please help me?

Thank You!!

解决方案

OK, I found the problem so I'm posting here for other people: Apparently this is a very delicate procedure... My config file was fine. All I needed to do is to define the breakpoints only after I connect to qemu, and not after loading the vmlinux. These breakpoints have to be HARDWARE breakpoints... otherwise they don't break!

这篇关于远程gdb调试不会停在断点处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆