My program uses a ton of third party libraries that sometimes put useful error messages into debugger output (using OutputDebugString()
).
Can my program somehow programmatically access that output so that it can parse it and report it to me in some more convenient manner?
To see the debug output window, in Microsoft Visual Studio, click View, click Other Windows, and then click Output. You can view the debug output in this window only if the debugger is attached to the process that is writing to the output window.
Debug Output is an OpenGL feature that makes debugging and optimizing OpenGL applications easier. Briefly, this feature provides a method for the driver to provide textual message information back to the application.
Tracing is a feature in Visual Studio that allows the programmer to put a log message onto the main output window. The mechanism is fairly simple to use. It is only active with debug builds, in a release build none of the trace messages will be displayed.
There is no API that gives you access to strings output through OutputDebugString
.
There are two ways of getting the data:
OutputDebugStringA
function.The OutputDebugString
protocol only supports a single listener so the first approach isn't compatible with multiple instances of your application, other applications doing the same thing or debuggers. It would also capture output from all applications. It is not a good idea. I mention it only because it is an obvious but wrong solution.
OutputDebugStringW
is (unusually) a wrapper around OutputDebugStringA
so the latter is the function to hook. There are lots of libraries that make hooking easy so every call to OutputDebugString
will become a call to a function you define, and you can do anything you like with the data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With