Author Topic: Support for OutputDebugString  (Read 6530 times)

zabzonk

  • Guest
Support for OutputDebugString
« on: August 09, 2012, 05:55:58 pm »
I'm writing a blog article on debugging techniques at the moment, and one of the things I want to cover is the Windows OutputDebugString API. I thought that the C::B debugger allowed you to see messages generated by this, but I guess I was mistaken or hallucinating, as a fairly recent nightly doesn't seem to. Is there any way of displaying messages generated this way, possibly by a plugin?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Support for OutputDebugString
« Reply #1 on: August 09, 2012, 06:01:35 pm »
Search MSDN how to do it, then we can try to think something about it.
Other option is to talk to the MinGW developers if they know something about this problem and if it is possible to modify gdb to print the information in its output.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

zabzonk

  • Guest
Re: Support for OutputDebugString
« Reply #2 on: August 09, 2012, 06:10:33 pm »
Quote
Search MSDN how to do it, then we can try to think something about it.

I know how it works - basically it writes to a memory mapped file protected by a mutex, which the debugger then needs to read. I just wondered if C::B supported it. Not a problem if it doesn't from my blog articles perspective. If anyone else here is wondering how to display the ODS messages, you can use a tool like DebugView at http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

zabzonk

  • Guest
Re: Support for OutputDebugString
« Reply #3 on: August 09, 2012, 08:22:40 pm »
Blog article is  at http://latedev.wordpress.com/2012/08/09/c-debug-macros/ if anyone is interested.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5931
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Support for OutputDebugString
« Reply #4 on: August 30, 2012, 05:19:32 pm »
Your article is quite good, but I think that if the gdb can receive the messages you send to, it will probably mess up the debugger's output parser.

I see such issue: Re: Debugger plugin: GDB MI interface features and issues, the message from wxLogMessage will shown in the gdb console, and in-fact, I don't like them.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.