How to debug ring0 code?

Programming, for all ages and all languages.
Post Reply
vargadanis
Posts: 7
Joined: Fri Sep 24, 2010 7:45 am

How to debug ring0 code?

Post by vargadanis »

Hi once again,

I am trying to debug my kernel code (if I dare to call it that) with bochs. I have recompiled bochs with gdb stubs, however I am unable to set breakpoints at all.
So I start bochs with gdb stubs enabled, it halts, waits for gdb to connect. I then issue these commands:
gdb
gdb remote localhost:1234
symbol-file kernel.bin
break kmain
break kernel.c:11
continue
Execution continues but nothing happens in the GDB. Am I missing something?
I have as well tried with qemu -s -S options with the same gdb commands as above however that doesn't do any good to me either. Have I not set something up well?
I have compiled my code with -g so the debug symbols should be present. Any tips?
Developing for fun...
Tosi
Member
Member
Posts: 255
Joined: Tue Jun 15, 2010 9:27 am
Location: Flyover State, United States
Contact:

Re: How to debug ring0 code?

Post by Tosi »

Do you have anything set up like paging enabled or a non-flat GDT that might be messing up your breakpoint addresses?
vargadanis
Posts: 7
Joined: Fri Sep 24, 2010 7:45 am

Re: How to debug ring0 code?

Post by vargadanis »

No..
In fact I have not even set up GDT yet. My code is very bare minimum.
Developing for fun...
Post Reply