problem debugging kernel with gdb
Posted: Mon May 21, 2012 2:30 am
Hi,
I am having problems debugging my kernel through remote gdb in both qemu and bochs.
I followed the instructions given in the wiki - http://wiki.osdev.org/How_Do_I_Use_A_De ... With_My_OS
As instructed I created a symbol file named kernel.sym for my kernel binary.
I have an assembly file loader.asm which calls the main function (kmain()) of the kernel in C.
When I start bochs and set the break point on the the function - kmain()
the break point gets set but on continuing it receives a SIGTRAP and terminates
Whereas without debugging the kernel is running fine on bochs.
When I try the same thing with qemu it hits the breakpoint at kmain()
but on stepping or next line it just runs through the code to get to the last line.
Here .bad is a label in loader.asm just after the call to kmain()
Please tell me if I am something wrong in both the cases or something extra needs to be done.
Thanks
Vaibhav Jain
I am having problems debugging my kernel through remote gdb in both qemu and bochs.
I followed the instructions given in the wiki - http://wiki.osdev.org/How_Do_I_Use_A_De ... With_My_OS
As instructed I created a symbol file named kernel.sym for my kernel binary.
I have an assembly file loader.asm which calls the main function (kmain()) of the kernel in C.
When I start bochs and set the break point on the the function - kmain()
the break point gets set but on continuing it receives a SIGTRAP and terminates
Whereas without debugging the kernel is running fine on bochs.
Code: Select all
(gdb) symbol-file kernel.sym
Reading symbols from /home/vaibhav/thesis/vscopy/kernel.sym...done.
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x00000000 in ?? ()
(gdb) break kmain
Breakpoint 1 at 0x10000c: file main.c, line 32.
(gdb) c
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0002be96 in ?? ()
(gdb)
When I try the same thing with qemu it hits the breakpoint at kmain()
but on stepping or next line it just runs through the code to get to the last line.
Code: Select all
(gdb) symbol-file kernel.sym
Reading symbols from /home/vaibhav/thesis/vscopy/kernel.sym...done.
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
[New Thread 1]
0x000f1996 in ?? ()
(gdb) break kmain
Breakpoint 1 at 0x10000c: file main.c, line 32.
(gdb) c
Continuing.
Breakpoint 1, kmain (bootinfo=0x2bd20) at main.c:32
32 {
(gdb) s
loader.bad () at loader.asm:65
65 loader.asm: No such file or directory.
in loader.asm
(gdb)
Please tell me if I am something wrong in both the cases or something extra needs to be done.
Thanks
Vaibhav Jain