Monthly Archive for March, 2007

gnn: Remote GDB on VMWare

One of the reasons to use virtual machines is that they make kernel debugging easier. No messing about with serial cables anymore, the simulator provides you with virtual serial ports, which to the operating system look just like real serial ports. In this entry I’ll explain how to use remote GDB with VMWare virtual machines. My current setup is VMWare 5.x on Linux with FreeBSD-CURRENT (7.x) as the guest.

In order to set up remote GDB you’ll need two virtual machines, one of which you’ll be debugging from, which I call devbox, and the other is the one you’re debugging which is often called a target, and which I call dut, short for Device Under Test.

Preparing a Kernel

For the DUT you will need to prepare a kernel that has support for remote GDB. Add the following lines to your kernel configuration file and compile the kernel on devbox:

options KDB # Enable kernel debugger support.
options DDB # Support DDB.
options GDB # Support remote GDB.

Install the newly compiled kernel into your DUT virtual machine. DO NOT INSTALL IT ON DEVBOX or you will be sorry.

On the DUT you will need to add the following lines to loader.conf: