Chapter 14 -- Limiting OutputDebugString Calls

[Previous] [Next]

Chapter 14

Have you ever heard the saying, "Too much of a good thing can kill you"? That phrase has often come to mind when I've had to search through 2 megabytes of trace statements looking for a single line to indicate what went wrong with my program—or worse yet, after I've dozed off waiting for the debugger to process the trace statements inside a loop that has 10,000 iterations. I'm willing to bet that you've suffered from trace statement glut as well and that you've been as annoyed by it as I have. I don't mean to seem overly critical of trace statements. As I said in Chapter 3, trace statements used correctly with assertions are great: they let you debug your application without the debugger. But too many trace statements spell trouble.

Having too many trace statements is especially bad in real-world team development. Everyone sprinkles in a few, and yours are lost in the morass as soon as you check in your code. Because trace statements quickly lose their effectiveness if they are overused, you stop adding them to your code—and thus lose some capability to debug your problems easily.

Wouldn't it be nice if you could use a ton of trace statements but only see the ones that came out of the source files you're interested in—no matter which modules they came from? The good news is that I've developed a utility that let's you do just that for both Microsoft Visual C++ and compiled Microsoft Visual Basic. After presenting my solution, I'll talk about some of the scrapes and bruises I earned implementing LIMODS (Limit OutputDebugStrings). Armed with LIMODS, you'll be in a better position to add as many trace statements to your applications as you like to help you debug your problems faster, without worrying that you've added too many. Go ahead—wallow in trace statement excess to your heart's content!



Debugging Applications
Debugging Applications for MicrosoftВ® .NET and Microsoft WindowsВ® (Pro-Developer)
ISBN: 0735615365
EAN: 2147483647
Year: 2000
Pages: 122
Authors: John Robbins

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