You can configure WinDbg to receive and display trace messages from a WDF driver. This allows you to view the messages in the WinDbg Command window in real time, while you are debugging the driver. This example shows how to redirect Osrusbfx2 trace messages to the WinDbg kernel debugger.
Chapter 11, "Driver Tracing and Diagnosability," provides information about WPP tracing, TraceView, and related tools and procedures.
Use the .load command to load Wmitrace.dll and Traceprt.dll.
These files contain tracing-related debugger extensions. They are located in the Program Files\Debugging Tools for Windows\Winxp folder.
Copy the driver's TMF files to a convenient folder on the host computer.
Use the !wmitrace.searchpath debugger extension to specify the location of the driver's TMF file.
Note To format the trace messages, the debugger must be able to find the TMF files.
Run WinDbg on the host computer and put it in kernel debugging mode.
Run TraceView on the test computer and create a new trace log session.
In the TraceView Log Session Options page, select Real Time Display, and then click Advanced Log Session Options.
In the Advanced Log Session Options page, on the Log Session Parameter Options tab, change the value of the WinDbg option to TRUE, and then click OK.
Click Finish to complete the process of creating the trace log session.
Run the Osrusbfx2 test application and make some changes in the display to generate trace messages.
Figure 22-8 shows how WinDbg displays trace messages that were generated by changing the lights on the device's light bar.
Figure 22-8: Viewing trace messages with WinDbg