Sending Output to the Debugger

User-mode and kernel-mode code use different routines to send output to the debugger.

User-Mode Output Routines

OutputDebugString sends a null-terminated string to the debugger of the calling process. In a user-mode driver, OutputDebugString displays the string in the Debugger Command window. If a debugger is not running, this routine has no effect. OutputDebugString does not support the variable arguments of a printf formatted string.

For complete documentation of this routine, see the Microsoft Windows SDK.

Kernel-Mode Output Routines

DbgPrint displays output in the debugger window. This routine supports the basic printf format parameters. Only kernel-mode code can call DbgPrint.

DbgPrintEx is similar to DbgPrint, but it allows you to "tag" your messages. When running the debugger, you can permit only those messages with certain tags to be sent. This allows you to view only those messages that you are interested in. For details, see Reading and Filtering Debugging Messages.

Note   In Windows Vista and later versions of Windows, DbgPrint produces tagged messages as well. This is a change from previous versions of Windows.

KdPrint and KdPrintEx are identical to DbgPrint and DbgPrintEx, respectively, when compiled in the checked build environment. When compiled in the free build environment, they have no effect.

For complete documentation of these routines, as well as the build environment, see the Windows Driver Kit.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft