Git Product home page Git Product logo

kernel-debug-lab-for-vmware's Introduction

How to set up a VMware lab to debug Kernel Driver with Windbg

For this tutorial, you need a physical Windows host computer responsible for running Windbg and another Windows host running virtually in VMWare.

Windbg download:

https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools

Windows iso download:

https://www.microsoft.com/en-us/software-download/windows10

Configuring Virtual Machine

  1. Open “Edit virtual machine setting” option

Untitled

  1. Add a Serial Port

Untitled

  1. In the details of the serial port configuration select “use named pipe”, define a name of your choice (\.\pipe\windbg in my case) and the checkbox “Yield CPU on poll” in I/O Mode:

Untitled

This serial COM port will be used to communicate over named pipe with Windbg running on the physical machine

  1. Power the VM on, open an elevated Command Prompt window and enter the following commands:
C:\>bcdedit /debug on
The operation completed successfully.

C:\>bcdedit /dbgsettings serial debugport:2 baudrate:115200
The operation completed successfully.

C:\>bcdedit /set testsigning on
The operation completed successfully.

Note: The *debugport *****number should correspond to the COM port number we configured with the named pipe (in my case 2 the same as the COM port)

Untitled

BCDEdit is a command-line tool for managing BCD stores. It can be used for a variety of purposes, including creating new stores, modifying existing stores, adding boot menu parameters, and so on

Parameters that Control Debugging

Parameter Description
/dbgsettings Specifies or displays the global debugger settings for the system. This command does not enable or disable the kernel debugger; use the /debug option for that purpose. To set an individual global debugger setting, use the bcdedit /set   command.
/debug Enables or disables the kernel debugger for a specified boot entry.
  1. Reboot the VM.

Configuring Windbg

  1. On the physical machine, open Windbg, select “Attach to kernel

Untitled

  1. In the COM tab check the “Pipe” and “Reconnect” checkboxes. After that, in the Port field, use the same named pipe as defined in the virtual machine's serial port configuration (\.\pipe\windbg)

Untitled

When finishing configuration, Windbg is able to receive new connections:

Untitled

Virtual machine debugging

Keep Windbg open and start the virtual machine by doing this Windgb will receive the message “Kernel Debugger connection estabilished”:

Untitled

Well done;

References:

kernel-debug-lab-for-vmware's People

Contributors

clivoa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.