[ros-kernel] kernel debugging howto

Vizzini vizzini at plasmic.com
Mon Nov 24 20:38:29 CET 2003


I have finally gotten tired of not having a kernel debugger so I thought
I'd document the process to get this set up.  Please note that I've done
this on UNIX; the process may vary slightly on Windows.

I still can't manage to get gdb to do serial debugging for me.  I think
something broke around the gdb-5.2 timeframe.  If anyone *is* managing
to use it, please post details.

The Bochs gdb stub does work, though.  It's a little bit limited in that
I have not been able to get it to send traps to the debugger (perhaps I
have it configured wrong or something).  However, you can set
breakpoints, single-step, etc., in the normal way.

The default bochs builds do not have the right configuration to work
with gdb.  You have to build your own.  Here is what I did:

1) Get the latest stable bochs source
2) Un-pack and compile it
  -> --enable-gdb-stub must be specified on configure
3) Set ReactOS to build with debug symbols
  -> DBG = 1 in reactos/config
4) Create a .gdbinit; mine looks like this:

directory /home/vizzini/reactos/ntoskrnl
directory /home/vizzini/reactos/drivers/net/ndis
add-symbol-file /home/vizzini/reactos/ntoskrnl/ntoskrnl.nostrip.exe
add-symbol-file /home/vizzini/reactos/drivers/net/ndis/ndis.nostrip.sys
0xddaea000
set disassembly-flavor intel
target remote 0:1234

Note that the address after ndis should be on the same line.  Also, that
address changes based on where the OS loads your driver.  It can figure
out ntoskrnl.exe by itself, though.

Hope this helps.

 -Vizzini




More information about the Ros-kernel mailing list