Using Bochs and the remote GDB stub
This section covers how you can use Bochs with a remote GDB stub to debug your kernel.
Configurating Bochs
The GDB stub is not active in standard Bochs binary package. So you must recompile Bochs.
Download the Bochs source package, untar it and run the configure script
with the `--enable-gdb-stub' argument.
$ ./configure --enable-gdb-stub |
After that, just run make and you should have a Bochs binary that contain a GDB stub in your directory.
Running Bochs
Just start Bochs as normal. Bochs will stop and wait for GDB to connect to the stub.
Running GDB
Bochs GDB stub waits for a connection on port 1234 on localhost (127.0.0.1). Just start GDB like this;
$ gdb YOUR-KERNEL
.
.
.
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
(gdb) |
You are now connected to the remote GDB stub in Bochs. You are now able to set breakpoints.
Use the continue (c) command to continue the simulation.
Hitting ^C works. Example;
Program received signal 0, Signal 0.
syscall_testsuite_result (aux=0x1f11fe4) at ../rtmk/syscalls.c:33
33 {
(gdb) |