Skip to content

Debugging with WDF Source

Alex Margarit edited this page Apr 24, 2015 · 5 revisions

This page describes how you can step through WDF source code in the debugger while debugging your WDF driver. This will help you get better understanding of the failure being triaged.

OS Requirements

In order to perform debugging with WDF source, your target machine must be running one of the Windows 10 builds available through the Windows Insider Program. The build must be from March 2015 or later.

Debugging in WinDbg

If you haven't used WinDbg before, we strongly recommend you start your learning with the MSDN documentation.

If you're familiar with the basics of WinDbg usage, then you'll find that debugging with the WDF source is very simple.

Option 1: Download the WDF Source Code

First, download the source from GitHub, either by cloning the repo or by downloading the repo as a zip and extracting it. In WinDbg, set the source path to point to your local copy of the WDF code. For example, if the source is located at c:\wdf-source, you can use the following command to set the source path.

.srcpath+ c:\wdf-source\src\framework

Option 2: Download Source-Indexed WDF PDBs

You can download source-indexed WDF PDBs (x86 and amd64) for the win-10.0.10041.0 release. Saving these locally and pointing WinDbg to them will allow you to step through the WDF source code hosted on GitHub, without the need to clone our repo.

  1. Download wdf-pdb.zip and extract it locally, say to c:\wdf-pdb.

  2. Break into WinDbg and set .sympath+ c:\wdf-pdb.

  3. If you previously downloaded WDF symbols from the Microsoft symbol server, you may need to unload the framework modules and clear the symbol cache with .reload /u Wudfx02000.dll and .reload /o /f Wudfx02000.dll. Replace Wudfx02000.dll with Wdf01000.sys for KMDF.


Now that the debugger is aware of the source, try breaking into a driver. If you see any WDF routines (those starting with wdf01000! or wudfx02000!) on the call stack, click one. A window with the source for that routine should appear.

That's it! Continue debugging as you normally would, but with the benefit of full transparency into WDF source.

Debugging in Visual Studio

Visual Studio 2015 supports a subset of the debugging functionality supported in WinDbg. You can use the same debugging commands in both Visual Studio and WinDbg.

Clone this wiki locally