Click here to Skip to main content
Click here to Skip to main content

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

, 4 Feb 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
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

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

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 
    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

  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".

  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)

Share

About the Author

Prasanna Venkatesh . K
Software Developer
United States United States
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411022.1 | Last Updated 4 Feb 2014
Article Copyright 2014 by Prasanna Venkatesh . K
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid