viksoe.dk

ATL debug trace classes


This article was submitted .


The atldebug header files contain helper macros that extend or replace the debug macros, which come built into the ATL library.

atldebugscan.h

Adds a new macro to your ATLTRACE arsenal.
The ATLTRACE_INTERFACES macro takes an IUnknown COM object as input and dumps any interface it supports to the debug log.

The code actually scans the entire set of registered interfaces in the system registry. It calls QueryInterface() on the object for each of them! It then matches up the valid interface GUIDs to a nice PROGID (if available) and dumps it to the debugger.

A similar function can be found in the atlaux library.

atldebugfunc.h

Adds indented function level tracing to your ATLTRACE macros.
Use the new ATLTRACEFUNC and ATLTRACEFUNCLOG macros instead of the old ATLTRACE to automatically produce logs at function/scope entry and exit.

Place one ATLTRACEFUNC at the very first line of every function. It will produce an entry and exit trace to the debug log, and it will indent the log according to the call-level hierarchy. Use the ATLTRACEFUNCLOG instead of the usual ATLTRACE calls to keep the same indentation as the logged method has.

Source Code Dependencies

Microsoft ATL Library

Download Files

DownloadSource Code (3 Kb)