0
votes

Why kgdb always start from kernel/kgdb.c:1749 lines "kgdb:waiting dor connection from remote gdb" just step on the way of kernel of Linux.

I want to start from the beginning.

My environment is:

  • PC ubuntu10.10
  • gdb-kernel 2.6.34.1
  • filesys made by busybox
  • VirtualMach is qemu

Following the tips from web searches, I have made my linux. I can use it smoothly but when I try to remote-gdb it the kernel always start from:

kernel/kgdb.c:1749 "kgdb:waiting for connection from remote gdb"

which is much too far away from the function start_kernel which I want to meet.

I am using the following:

qemu -kernel /usr/src/work/bzImage -append "root=/dev/sda kgdboc=ttyS0,115200 kgdbwait" 
     -boot c -hda /usr/src/work/busybox.img -k en-us -serial tcp::4321,server

gdb /usr/src/work/vmlinux  (gdb) target remote localhost:4321

Then I add -S so it can start from the beginning. But when I gdb it there is still something wrong.

When I input the command next it doesn't go to the next line and go to other place. For example I set a breakpoint at init.c startkernel() after the next. It is in other file.

1
thx.. i am going to have a try - yueyue

1 Answers

0
votes

If "kgdb:waiting dor connection from remote gdb" isn't early enough for you, you're going to have to try something other than kgdb. Think about this: kgdb is a service provided by the kernel. You can't debug the kernel "from the beginning" because the kernel has to perform enough initialization for it to provide the kgdb service.

Fortunately, there's another option for you. According to this source, if you start qemu with the flags -s -S, qemu will start the system and wait for you to attach a debugger to localhost:1234 before it even loads the kernel. Is that early enough?