Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

So, before I came to my current place of employment, the windows OutputDebugString function was completely unheard of, everyone was adding debug messages to string lists and saving them to file or doing showmessage popups (not very useful for debugging drawing issues). Now everybody (all 6 of us) is like "What can I say about this OutputDebugString?" and I'm like, "with much power comes much responsibility."

I kind of feel as though I've passed a silent but deadly code smell to my colleagues. Ideally we wouldn't have bugs to debug right? Ideally we'd have over 0% code coverage, eh? So as far as petty debugging is concerned (not complete rewriting of a 3 million line Delphi behemoth) what's a better way to use debug running code than just adding OutputDebugString all over?

share|improve this question
add comment

2 Answers

Well, if you've got access to an interactive debugger with breakpoints and watches and all, I'd suggest that. If you don't want an interactive debugger, how about a logging utility? Log4J is a good logger for Java apps, and there's a .NET equivalent as well (log4net).

share|improve this answer
    
Yeah, I meant to frame the question to exclude the interactive debugger, but I don't know what you call all non-interactive debugging, I guess it's pretty much just logging. I think Eurekalog is a good Delphi equivalent, I'm currently using the shareware version to catch leaks and stuff but I've never used it for logging. –  Peter Turner Mar 1 '11 at 15:00
    
@Peter Turner: You might want to clarify that this is specifically for Delphi. Also, if there's a good logging tool, it's worth trying for execution tracing for debug purposes. Does it have different logging levels? The option to output to different files? –  FrustratedWithFormsDesigner Mar 1 '11 at 21:55
    
Yeah, I wasn't intending for this to be a Delphi centric question. Lots of the guys who write Delphi tools make ones that work with Visual Studio. I really was hoping for a better overall method. Like OutputDebugString() is 10 times better than StringList logs so FancyMcFoo() might be 100 times better than OutputDebugString(). Log levels would definitely be an improvement on OutputDebugString, although you can just build that into your code with conditional define statements. –  Peter Turner Mar 1 '11 at 22:06
add comment

When I used to write in Delphi, I was quite fond of the lightweight GDebug utility which is part of the GExperts tools that brings quite a few handy developments tools: it was especially handy for debugging DLLS used by a host application that was not allowed to be run in debuggers by design (because of its DRM mecanism).

If you are familiar with javascript, it's like the equivalent of console.log/warn/error: not a "real" debugger in the sense that (as far as I recall) you don't see the call stack, it's more a logs console.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.