The MSVC debugger supports several debuggee-invoked APIs that are used frequently in game dev and other Windows-oriented C++ dev environments. One of these APIs of particular interest is OutputDebugString.
The idea is pretty simple -- you call OutputDebugStringA (or the wide-character W variant) and pass some information along. At runtime, the data fed to this call is dropped on the floor if no debugger is attached (IsDebuggerPresent returns false). If a debugger is attached however, the output is passed along to the debugger to display in the debug output window. As the MSVC debugger is proprietary, I can't comment on the exact implementation, but I imagine this is done using an inherited file handle, a named pipe (namespaced to the specific debugger invocation), or some other similar IPC mechanism.
In terms of usage, OutputDebugString is used in a myriad number of ways, but the chief usage is to enable printf-like debugging functionality in environments where there isn't even a console at all (GUI/windowed-applications where AllocConsole isn't called). It's also useful as a mechanism to output debug text without interleaving with stdout or any other standard file stream.
I am not personally too familiar with DAP, but this may be something worth generalizing if a concept like this doesn't already exist, as suggested by user David Spickett on Discord here. I could see the debug data being passed to either a dedicated debuggee LLDB log channel in addition to being forwarded via DAP for the IDE/editor to present to the user in some way.
The MSVC debugger supports several debuggee-invoked APIs that are used frequently in game dev and other Windows-oriented C++ dev environments. One of these APIs of particular interest is OutputDebugString.
The idea is pretty simple -- you call
OutputDebugStringA(or the wide-characterWvariant) and pass some information along. At runtime, the data fed to this call is dropped on the floor if no debugger is attached (IsDebuggerPresentreturnsfalse). If a debugger is attached however, the output is passed along to the debugger to display in the debug output window. As the MSVC debugger is proprietary, I can't comment on the exact implementation, but I imagine this is done using an inherited file handle, a named pipe (namespaced to the specific debugger invocation), or some other similar IPC mechanism.In terms of usage,
OutputDebugStringis used in a myriad number of ways, but the chief usage is to enable printf-like debugging functionality in environments where there isn't even a console at all (GUI/windowed-applications whereAllocConsoleisn't called). It's also useful as a mechanism to output debug text without interleaving withstdoutor any other standard file stream.I am not personally too familiar with DAP, but this may be something worth generalizing if a concept like this doesn't already exist, as suggested by user David Spickett on Discord here. I could see the debug data being passed to either a dedicated debuggee LLDB log channel in addition to being forwarded via DAP for the IDE/editor to present to the user in some way.