Starting with Windows
Vista, Microsoft changed the Windows Boot Manager, thereby changing the way we
debug the Windows Kernel. Now, there is a new tool called bcdedit.exe which can
be used to modify the boot configuration of a Windows installation.
The goal is to set up
kernel debugging via virtual serial port, on a Windows 8 guest VM running on a
Windows 8 host via the built in Hyper-V that comes with Windows 8. The pipe
name will be “debug” in this example. The first step is to enable the COM port
of the guest VM in the VM’s settings:
Next, enable kernel
debugging on the guest VM by running the following commands from an elevated
command prompt on the guest:
bcdedit /debug on
bcdedit /dbgsettings
serial debugport:1 baudrate:115200
The next step is to
prepare the host for debugging the guest VM. The host had the Windows 8 SDK,
WDK, Visual Studio 2012, and the Visual Studio 2012 coinstaller installed, in
that order. There are 2 ways to debug kernels in guest VMs from a Windows 8
host. The first is to use Visual Studio 2012 (new method), and the second is to
Windbg (old method). Visual Studio 2012 now has integrated kernel debugging
support using the same debugging engine as Windbg. Once the host machine has
everything installed, the steps to debug using Visual Studio 2012, are as
follows:
-
Run Visual Studio 2012
as Administrator
Under the
Tools->Attach to Process window, select "Windows Kernel Mode
Debugger" for Transport.
Click "Find"
next to "Qualifier"
In the "Configure
Computers" window use the following settings:
Transport=Serial
Port=\\.\pipe\debug
Baud=115200
To use the old Windbg
method:
- Run Windbg as Admin on the host
- Hit ctrl+k to connect to the serial port exposed by the VM
- Use the following settings
Further Reading: