Enable Remote Kernel Mode Debugging on Hyper-V Virtual Machine
1) start an elevated command prompt and turn on debugging
bcdedit /debug on
2) configure debugger to use COM1
bcdedit /dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200
3) reboot so boot loader can read new bcdstore settings
Now, we need to configure Hyper-V to redirect COM1 to TCP named pipe
1) Hyper-V -> VM settings -> COM1
change from "none" to "pipe name" and provide a descriptive name which we will use later in winbdg
Note: Please take a note of the named pipe path as we will use this later in windbg
- Download and install the Debugging Tools for Windows from https://msdn.microsoft.com/en-us/windows/hardware/gg463009
- Start 'WinDbg' and choose 'Run as administrator' (Windbg needs administrative rights to connect to the pipe)
- In windbg open the File menu and choose 'Remote Stub'
- Here we need 'Remote Stub' path (replace server=HYPERV1 by your Hyper-V hostname)
- tcp:server=HYPERV1,port=10240
- then go to 'Kernel Debug'-> COM
- Enter a Baud Rate of 115200, to match the settings made in the VM and replace HYPERV1 by your Hyper-V hostname a.e.
- \\HYPERV1\pipe\ramaca160902-125416-VM693
- Enter a Baud Rate of 115200, to match the settings made in the VM and replace HYPERV1 by your Hyper-V hostname a.e.
Voila - To verify your debugger connection you can break in which should give you a kd> prompt. From here it's all yours 😊
/en-us/windows-hardware/drivers/debugger/attaching-to-a-virtual-machine--kernel-mode-
https://msdn.microsoft.com/en-us/library/ms932907(v=winembedded.5).aspx