Tracing messages with Windows

The OutputDebugString function is used to send messages to a debugger. The function does this through a shared memory section called DBWIN_BUFFER. Shared memory means that any process can access this memory, and so Windows provides two event objects called DBWIN_BUFFER_READY and DBWIN_DATA_READY that control read and write access to this memory. These event objects are shared between processes and can be in a signalled or unsignalled state. A debugger will indicate that it is no longer using the shared memory by signalling the DBWIN_BUFFER_READY event, at which point the OutputDebugString function can write the data to the shared memory. The debugger will wait on the DBWIN_DATA_READY event, which will be signalled ...

Get Beginning C++ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.