Click here to Skip to main content
15,886,724 members
Articles / Operating Systems / Win8
Tip/Trick

How to Setup a Windbg Kernel Debugger to Debug Hyper-V Windows Client

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
4 Feb 2014CPOL1 min read 17.6K   5  
Debug your driver within a VM

Introduction

Windows virtual machines are more common now-a-days and debugging them becomes a common task for the developers. In this tip, we will learn how to setup a "Kernel Debug"(KD) connection to the Virtual Machine(VM) guest Operating System(OS).

In this tip, I will refer to two terms "Guest Operating System" and "Host Operating System". Host Operating System here means server where the Hyper-V Manager is installed and the Guest Operating System is the one installed inside the VM.

Setting up the Hyper-V manager (Host OS)

  1. Open the settings window of the VM you want to setup with kernel debugging

    Image 1

  2. Edit the settings window for COM1. In this example, I'm using the pipe name "vm1".

    Image 2

Setting up the Hyper-V client (Guest OS)

  1. In an elevated Command Prompt window, enter the following commands, where n is the number of the COM port used for debugging on the target computer, and rate is the baud rate used for debugging:

    bcdedit /debug on <br />bcdedit /dbgsettings serial debugport:n baudrate:rate

    Note: The baud rate must be the same on the host computer and target computer. The recommended rate is 115200.

    In this example, please use "bcdedit /dbgsettings serial debugport:1 baudrate:115200"

Setting up Windbg (Host OS)

  1. Install Windbg in the host OS from here.

  2. Open Windbg.exe and edit the kernel debug option from the file menu

    Image 3

  3. Set baud rate and port to match with step 2 and 3.

    Set the baud rate to "115200" and this should be the same as step 3 baud rate.

    Set port to "\\.\pipe\vm1" this port name comes from step 2 "named pipe path".

    Image 4

  4. Restart the Hyper-V guest OS and when the VM starts Guest OS should be connected to the Windbg.

History

  • Initial version: 02/04/2014

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --