Debugging Macros

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The following table summarizes the debugging macros.

You can use these macros to call the debugging functions RegisterDbgZones, NKDbgPrintfW, DebugBreak, and WriteDebugLED conditionally based on whether you want these calls to appear in Debug, Retail, and Ship builds.

Macro Description

DEBUGREGISTER (hMod)

Calls RegisterDbgZones to register zones for the current module (a DLL or process).

This macro only registers zones on Debug builds; it does nothing on Retail and ship builds.

This macro assumes that a global variable dpCurSettings has already been defined, where dpCurSettings must be a DBGPARAMstructure.

RETAILREGISTERZONES (hMod)

Calls RegisterDbgZones to register zones for the current module (a DLL or process).

This macro only registers zones on Debug and Retail builds; it does nothing on Ship builds.

This macro assumes that a global variable dpCurSettings has already been defined, where dpCurSettings must be a DBGPARAMstructure.

DEBUGZONE (n)

Associates a mask bit with a zone.

DEBUGMSG (cond, printf_exp)

Conditionally outputs a formatted debugging message to NKDbgPrintfW.

This macro is only present in Debug builds; it does nothing on Retail and ship builds.

RETAILMSG (cond,printf_exp)

Conditionally outputs a formatted debugging message to NKDbgPrintfW.

This macro is only present in Debug and Retail builds; it does nothing on ship builds.

ERRORMSG (cond,printf_exp)

Conditionally outputs a formatted error message to NKDbgPrintfW, adding the file name and line number where the error occurred.

This macro is only present in Debug and Retail builds; it does nothing on ship builds.

DEBUGCHK (exp)

Asserts an expression and produces a DebugBreak if the expression is FALSE.

This assertion is only present in Debug builds; it does nothing on Retail and Ship builds.

This macro assumes that a global variable dpCurSettings has already been defined, where dpCurSettings must be a DBGPARAMstructure.

ASSERT (exp)

Asserts an expression and produces a DebugBreak if the expression is FALSE.

This assertion does not assume dpCurSettings is present. The assertion is only present in Debug builds; it does nothing on Retail and Ship builds.

ASSERTMSG (msg, cond)

Asserts an expression, and if the expression is FALSE, produces an error message to NKDbgPrintfWand a DebugBreak.

This macro is only present in Debug builds; it does nothing on Retail and Ship builds.

DEBUGLED (cond, parms)

Conditionally outputs a pattern to WriteDebugLED.

This macro is only present in Debug builds; it does nothing on Retail and Ship builds.

RETAILLED (cond, parms)

Conditionally outputs a pattern to WriteDebugLED.

This macro is only present in Debug and Retail builds; it does nothing on Ship builds.

See Also

Other Resources