Best Practices: Design for Diagnosability


Generating trace messages is a relatively easy way to record what your driver is doing. You can use the messages to track the path of an I/O request through your code, to figure out where bugs might be, and determine which routines are called frequently and which are rarely exercised. With this information, you can diagnose driver problems more easily.

To get the most out of tracing, observe these best practices:

  • Define trace flags that correspond to the types of information that you find most helpful during debugging.

    For example, as you incrementally implement and test your code, you could define a new flag for each new driver module.

  • Do not conditionally compile the trace statements in your driver.

    Leave them in the retail binaries-trace messages have a noticeable performance impact only if a trace consumer explicitly enables them.

  • Place a trace message in every error path.

    The message can provide detailed information to help diagnose the cause of the error with relatively little overhead.




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