Kernel debugging with Qemu and gdb
Hi,
I am trying to debug a panic problem observed in linux 3.x kernels. I have seen it with 3.4.48,3.8.8 and 3.9.4. I have trouble debugging the kernel with gdb. STEPS TRIED -------------------------- These are my command-line : qemu-system-x86_64 -m 256 -kernel vmlinuz-3.x -initrd initramfs-3.x -s -S -hda rootfs.img -append "root=/dev/sda1" To debug : I do gdb vmlinux-3.x (gdb) target remote:1234 (gdb) c I run the qemu and the gdb on the same machine. I am root and have set iptables -F. I have also set CONFIG_DEBGUG_INFO. OBSERVATION ---------------------------- My problem is that gdb hangs after 'c' . It does not proceed. When I do Ctrl-C, I observe at the prompt "interrupted while waiting for the program". I feel I m missing something. The qemu output is relayed through vnc. But after 'c' in gdb. I do not see anything in the vncviewer console. I assume that the kernel is not being executed. SUMMARY -------------------- In short, my main problem is debugging with gdb. I am not able to run the kernel using gdb so that I can do a trace analysis at the required breakpoint. I have seen in gdb-tutorials for kernel where they proceed with kernel execution with cont. But that too do not work in my case. Help is appreciated. |
Let's first address "I assume that the kernel is not being executed."
After 'c' what do you get from doing the qemu command 'info cpus' a few times? Are the cpus halted? Is the instruction pointer changing? |
The prompt does not come after pressing 'c'. gdb terminal hangs. Have to Ctrl-D to terminate gdb
|
After a 'c' nothing should be happening on the gdb terminal because the system is running. You can only type gdb commands when you are in a breakpoint or Ctl-C.
The qemu prompt is what you get in the term where you issued the qemu-system-x86_64 command. |
All times are GMT -5. The time now is 02:53 AM. |