visual-studio-debuggingdebugview

detect identity of attached debugger from windows c++ app


I'm writing a Windows app in C++ and I'm writing a lot of diagnostic information to the debugger (with OutputDebugString).

Sometimes I debug in Visual Studio itself and sometimes I use SysInternals DebugView. I'd like to have a separate output format in each case. For Visual Studio I'd like the full path and line number so I can double-click to go to source, but that takes up too much space in DebugView.

Is there a way to tell which debugger is attached from my program? I can call IsDebuggerPresent() but it doesn't differentiate between Visual Studio and DebugView.


Solution

  • Is there a way to tell which debugger is attached from my program?

    I'm afraid not. From reading debugapi.h,there is no built-in way to definitively differentiate between different types of debuggers. I suggest you can get help from Win32-API Microsoft Q&A or submit a feature request from Product feedback

    That will allow you to directly interact with the appropriate product group, and make it more convenient for the product group to collect and categorize your suggestions.