0

When I compile and run my Delphi apps from the IDE, the debug output (from calls to OutputDebugString) goes to the event log window of the IDE. When I run the compiled EXE stand-alone, the debug output goes to whatever debug viewer that is running.

I use DebugView++ to monitor the debug messages when running stand-alone. It's brilliant. Way faster than DebugView, and it has pretty powerful filtering and formatting capabilities (with RegExp pattern matching).

The Delphi event log viewer suffers from some major drawbacks:

  • it has a significant impact on program performance
  • it can't use a monospaced font (or that I have found anyway)
  • there is minimal filtering (yes - you can color-code so that Thread messages are a different color to Breakpoint messages for example, but you can't do things like show debug output lines that match "Error:" with a red background. Filtering is also really important if the debug stream has lots of chaff that you want to ignore.

I want the best of both worlds. I want to run my program from the IDE (so I can break, step, inspect and modify variables, etc.), but I want the output to go to DebugView++. Is this possible?

rossmcm
  • 5,493
  • 10
  • 55
  • 118
  • 1
    AFAIK, no it is not possible. When an actual debugger is attached to the process, debug messages are sent only to the debugger, not to an external viewer. – Remy Lebeau Apr 24 '19 at 21:17
  • No. If there is a debugger present (see [CheckRemoteDebuggerPresent](https://msdn.microsoft.com/en-us/library/ms679280(v=VS.85).aspx) and the link on that page to `IsDebuggerPresent`) - if either of them returns true, OutputDebugStr sends the output to the debugger itself. – Ken White Apr 25 '19 at 00:22
  • Hmm. Sad face. There seems to be any number of Delphi add-ons that hook into the compiler/IDE and modify its behavior. All I actually need is a way of intercepting that stream of characters on its way to the Event log window and redirecting it. – rossmcm Apr 25 '19 at 05:17
  • Thanks, @Sertac - indeed this is a duplicate of [Bypass OutputDebugString in Delphi 7](https://stackoverflow.com/questions/3116069/bypass-outputdebugstring-in-delphi-7). The question even includes a comment from me! – rossmcm Apr 25 '19 at 19:54

0 Answers0