none
Redirect debugger output to a file

    Question

  • I need to redirect debugger output(where you can see log of loading symbols or First chance of Exception if you have when you run your application)  to a file.  I should process this output for memory leak which is too long and I lost most of them in IDE output windows.(I used VLD 1.0. This tools show memory leak in the debugger output window)

    Thanks in advance

    Tuesday, April 28, 2009 1:27 PM

Answers

  • Theoretically the OutputDebugString function can be intercepted after attaching a custom debugger using DebugActiveProcess (probably outside the Visual Studio Debugger), or using Microsoft Detours Express. But it is more complicated. Maybe it is possible to create a macro which saves the contents of Output window after terminating the application?

    • Marked as answer by Majid L Wednesday, April 29, 2009 11:11 AM
    Wednesday, April 29, 2009 6:09 AM
  • You could use the SysInternals' DbgView utility.   Of course, if you're not allowed to use the Windows SDK, you're surely not allowed to use these kind of utilities.  Bummer.

    Hans Passant.
    • Marked as answer by Majid L Wednesday, April 29, 2009 11:11 AM
    Wednesday, April 29, 2009 6:19 AM
    Moderator

All replies

  • You can get the source code for it.  Change it.  Modify VisualLeakDetector::report() to write to a file instead of using OutputDebugString().
    Hans Passant.
    Tuesday, April 28, 2009 7:21 PM
    Moderator
  • Thanks nobugz, so you said there is no way to redirect debugger output. Because of some issue in my company, we are not able to install platform SDK, so I can not change the source code and compile it.

    Wednesday, April 29, 2009 4:58 AM
  • Theoretically the OutputDebugString function can be intercepted after attaching a custom debugger using DebugActiveProcess (probably outside the Visual Studio Debugger), or using Microsoft Detours Express. But it is more complicated. Maybe it is possible to create a macro which saves the contents of Output window after terminating the application?

    • Marked as answer by Majid L Wednesday, April 29, 2009 11:11 AM
    Wednesday, April 29, 2009 6:09 AM
  • You could use the SysInternals' DbgView utility.   Of course, if you're not allowed to use the Windows SDK, you're surely not allowed to use these kind of utilities.  Bummer.

    Hans Passant.
    • Marked as answer by Majid L Wednesday, April 29, 2009 11:11 AM
    Wednesday, April 29, 2009 6:19 AM
    Moderator