How to View Trace Messages with WinDbg


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.

To configure WinDbg to display trace messages
  1. 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.

  2. Copy the driver's TMF files to a convenient folder on the host computer.

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

To Start a Debugging Session that Displays Trace Messages
  1. Run WinDbg on the host computer and put it in kernel debugging mode.

  2. Run TraceView on the test computer and create a new trace log session.

  3. In the TraceView Log Session Options page, select Real Time Display, and then click Advanced Log Session Options.

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

  5. Click Finish to complete the process of creating the trace log session.

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

image from book
Figure 22-8: Viewing trace messages with WinDbg




Developing Drivers with the Microsoft Windows Driver Foundation
Developing Drivers with the Windows Driver Foundation (Pro Developer)
ISBN: 0735623740
EAN: 2147483647
Year: 2007
Pages: 224

Similar book on Amazon
Windows Internals, Part 1: Covering Windows Server 2008 R2 and Windows 7
Windows Internals, Part 1: Covering Windows Server 2008 R2 and Windows 7
Windowsu00ae Internals: Including Windows Server 2008 and Windows Vista, Fifth Edition (Pro Developer)
Windowsu00ae Internals: Including Windows Server 2008 and Windows Vista, Fifth Edition (Pro Developer)
Advanced Windows Debugging
Advanced Windows Debugging
The Windows 2000 Device Driver Book: A Guide for Programmers (2nd Edition)
The Windows 2000 Device Driver Book: A Guide for Programmers (2nd Edition)

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net