5

I'm wondering if it's possible to bypass the OutputDebugString? I'd like the OutputDebugString output showing up in DebugView and not in the internal Delphi Event Viewer window. But i can't find a way to tell Delphi not to swallow the OutputDebugString. Any ideas?

regards

4
  • 2
    It ought to show up in the Delphi Window and in DebugView. Can you confirm that's happening? Commented Jun 25, 2010 at 6:45
  • 2
    I've got Delphi 7 too and it is not showing in DebugView, only in the Delphi Event Log. Commented Jun 25, 2010 at 6:49
  • 2
    It's only showing in the Delphi Event Log if it's running in a debug session. If the app is started without attached debugger OutputDebugString is catched by DebugView. Commented Jun 25, 2010 at 6:55
  • AFAIK pnly one debugger at a time can receive OutputDebugString output Commented Jun 25, 2010 at 6:58

5 Answers 5

5

That is not possible.

OutputDebugString sends string to debugger (as its name suggests). There can be only 1 active debugger per process. You run your application under Delphi - Delphi got the messages, since its a debugger. You run your application outside Delphi - DebugView can access them, since no debugger claimed it.

However: WHY do you need this? Just disable other types of events in Delphi event log - and you'll get the same functionality as DebugView has.

Sign up to request clarification or add additional context in comments.

10 Comments

I know that the output is send to the debugger. My question is how to bypass it. But it looks like there's no way to bypass it. And i don't get the same functionality if i disable the other types. I'm still receiving hundreds of debug messages. In DebugView i can filter the output and thus i'll only see what i'm interested at the moment. That makes a huge difference.
@pantharhei: looking here d-fens.net/…, it appears to me that it should be possible. The source code of the redirection is available from the author on request.
@Lieven: That looks interesting. Will have a closer look if the time pressure is gone. Will it ever be gone? ;)
I think that you're asking too much from this simple debugging routine. Try to look to other logging solutions, like ETW ( msdn.microsoft.com/en-us/library/bb968803(VS.85).aspx ) or SmartInspect ( gurock.com/smartinspect ) or anything else.
@Lieven Your link talks about different thing. It discusses tool, which acts as debugger reading output from OutputDebugString and transfer it to other session, where actual debugger is. There are 2 debuggers, each one is connected to separate sources. There are 2 sources and 2 debuggers. This is different from the situation in question, where pantarhei wants 2 debuggers (Delphi and DebugView) connect to single source. And you can't do that, since reading from source involves using auto-reset events. Once debugger use them - no other application can use them too for obvious reasons.
|
1

I think there is no way around this. The situation is still the same in Delphi 2009. You should submit a feature request: http://qc.embarcadero.com

I'm wondering what the advantage instead of Delphi's internal event log window should be?

7 Comments

The advantage is that you can filter the debug strings in DebugView. Makes the life much easier.
Do you really need more than the on/off filter in Delphi? ;-)
Submitting a feature request for D7? Are you kidding me? I'm pretty sure that they are not going to add it do D7 if it isn't possible at the moment in D09.
Needless to say that I meant a feature request for future versions. It doesn't help you now, but it's a useful request.
I'm pretty sure that way back in 1998 somebody said: "Submitting a feature request for D2? Are you kidding me? I'm pretty sure that they are not going to add it do D2 if it isn't possible at the moment in D4" :D That's why we still don't have this feature in D7 and D2010 and we'll never have it, since nobody cares about reporting it.
|
1

Instead of DebugView you can try to use Process Monitor and its new "debug output" capability. It does not use OutputDebugString, it uses its own API, and there's also a Delphi wrapper here. You can use Process Monitor filtering features and Delphi won't trap that messages - but it's not a generic features as those of OutputDebugString.

1 Comment

Could use it for my own local tests. But i don't think that i will make it into the code base. But i'll take a look on it. Thanks.
0

Disabling "output messages" in the Event Log properties does not work?

2 Comments

Result is that the messages aren't displayed in the internal Event Log. But they're still swallowed by the debugger.
I am afraid the once a debugger it attached to a process Windows sends the output to that debugger.
0

Not what the original question asked, I realise, but it's worth taking a look at CodeSite from Raize Software. It takes OutputDebugString to a whole new level. Messages (can) get directed to a CodeSite viewer which is roughly equivalent to a highly souped up DebugView. Well worth every penny IMHO.

3 Comments

Sure. But it's not in my responsibility to order or introduce these tools. I've also looked at SmartInspect. Would be nice to have, for sure. But not at the moment.
On the contrary, Pantarhei, it's everybody's responsibility to introduce useful tools to their peers.
Ok. Used the wrong words. So i introduced the tools already. But i can't decide if they will be bought and integrated into the existing tooling.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.