Installing Development builds of VirtualBox with GDB Support

The recent versions of VirtualBox support debugging the target directly (i.e. without the use of kgdboe or kgdboe) with a built-in GDB stub.

However, this functionality is only available in the development snapshots of VirtualBox and requires disabling the Hyper-V platform on the host.

In order to debug a Linux kernel running inside a VirtualBox VM, follow the steps below:

  1. Download and install the latest development snapshot of VirtualBox (not a test build). You can also get the latest version successfully tested with VisualKernel here.
  2. When the VM is stopped, run the following commands:

    Replace 1234 with the port number on the host that you would like to use for debugging.
  3. Start the VM. Once it loads, start a gdb executable on the host and run the following command:

You will now be able to debug the target kernel using VirtualBox.


The VirtualBox GDB stub has the following known limitations:

  1. It is only supported in the development snapshots of VirtualBox. Stable releases do not include it.
  2. It does not work when the host has Hyper-V virtualization enabled. If you encounter strange debugging behavior, make sure Hyper-V is disabled:
  3. The VirtualBox GDB stub has higher latency than the VMWare or QEMU gdb stubs. Expect a ~1 second delay after hitting each breakpoint. If the overall debugging performance is too slow, try disabling the printk() hook in VisualKernel settings, as it involves setting a breakpoint.

Integration with Visual Studio

See this tutorial for detailed steps on debugging a VirtualBox guest kernel with Visual Studio.