I'm having problems with debugging my modified Linux-3.11.0 kernel. For debugging the code, I use:
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!!
To exit GDB, use the quit command (abbreviated q ), or type an end-of-file character (usually C-d ). If you do not supply expression , GDB will terminate normally; otherwise it will terminate using the result of expression as the error code.
Setting breakpoints A breakpoint is like a stop sign in your code -- whenever gdb gets to a breakpoint it halts execution of your program and allows you to examine it. To set breakpoints, type "break [filename]:[linenumber]". For example, if you wanted to set a breakpoint at line 55 of main.
This problem occurs because ASP.NET debugging isn't enabled on the application.
If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With