-
Notifications
You must be signed in to change notification settings - Fork 365
Debugging with WDF Source
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.
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.
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.
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
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.
-
Download wdf-pdb.zip and extract it locally, say to
c:\wdf-pdb
. -
Break into WinDbg and set
.sympath+ c:\wdf-pdb
. -
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
. ReplaceWudfx02000.dll
withWdf01000.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.
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.