1

I would like to know how to debug the linux kernel using QEMU and gdb. I have compiled new kernel linux-3.18.6 in my VM. My VM environment is centos and kernel version is 3.10.0-327.el7.x86_64. I use the command "qemu-system-x86_64 -kernel /usr/src/linux-3.18.6/arch/x86/boot/bzImage -initrd rootfs.img -s -S" to run the new kernel. Then, I use another shell window to run "gdb ./vmlinux", everything is good until now. But, when I keep going to input "target remote localhost:1234". It prints some weird messages.Like this

(gdb) target remote localhost:1234

Remote debugging using localhost:1234

Remote 'g' packet reply is too long: 

00000000000000000000000000000000000000000000000063060000000000000000000000000000  
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000f0ff0000000000000200000000f0000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
000000007f0300000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000801f0000

(gdb) c

The program is not being run.

Then, when I type 'c'. It will show "The program is not being run.". I have been confused by this problem for several days. Can anybody help me to fix it and let the program run. Thanks a lot.

2
  • There is a similar bug report for this issue: sourceware.org/bugzilla/show_bug.cgi?id=13984. You can try to apply the patch attached to bug report and rebuild gdb. Commented Aug 3, 2017 at 20:58
  • Thanks a lot. It works for me ! Commented Aug 4, 2017 at 15:34

1 Answer 1

1

This is gdb bug 13984. There is a patch attached to it which resolves this bug.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.