Connect Kernel Debugger to a Virtual PC/Virtual Server virtual machine

Virtual Machine completely changes how people test software (Well, definitely me.). Create a virtual machine, enable undo disk, install your changes, test it. Does not work? Throw away the undo disk, and you have a brand new machine to work with.

For people working on drivers or critical system services, more often than not their test machines are always attached to a kernel debugger. You can also attach the kernel debugger to a virtual machine in a few single steps:

1. Map the COM port of the virtual machine to a named pipe. See the following picture for an example.

 

2. Enable debugging on the target machine

c:\>more boot.ini

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect /debug /debugport=com1

3. If the virtual machine is hosted on a different machine from where the kernel debugger is launched, make sure the kernel debugger can access the named pipe in the host machine. For the most part this means enable file sharing in the firewall.

4. connect kernel debugger to the target machine

C:\>kd -k com:port=\\MyVirtualServer\pipe\vpcxpcom1,pipe,resets=0,reconnect

Microsoft (R) Windows Debugger Version 6.6.0007.5
Copyright (c) Microsoft Corporation. All rights reserved.

Opened \\MyVirtualServer\pipe\vpcxpcom1
Waiting to reconnect...

Connected to Windows XP 2600 x86 compatible target, ptr64 FALSE
Kernel Debugger connection established.