Click to Rate and Give Feedback
MSDN
MSDN Library
Diagnostics
Basic Debugging
Debugging Reference
Debugging Functions
 OutputDebugString Function
OutputDebugString Function

Sends a string to the debugger for display.

void WINAPI OutputDebugString(
  __in_opt  LPCTSTR lpOutputString
);

Parameters

lpOutputString

The null-terminated string to be displayed.

Return Value

This function does not return a value.

Remarks

If the application has no debugger, the system debugger displays the string if the filter mask allows it. (Note that this function calls the DbgPrint function to display the string. For details on how the filter mask controls what the system debugger displays, see the DbgPrint function in the Windows Driver Kit on MSDN.) If the application has no debugger and the system debugger is not active, OutputDebugString does nothing.

Prior to Windows Vista:  The system debugger does not filter content.

OutputDebugStringW converts the specified string based on the current system locale information and passes it to OutputDebugStringA to be displayed. As a result, some Unicode characters may not be displayed correctly.

Applications should send very minimal debug output and provide a way for the user to enable or disable its use. To provide more detailed tracing, see Event Tracing.

Requirements

Client Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Server Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Header

Declared in Winbase.h; include Windows.h.

Library

Use Kernel32.lib.

DLL

Requires Kernel32.dll.

Unicode

Implemented as OutputDebugStringW (Unicode) and OutputDebugStringA (ANSI).

See Also

Communicating with the Debugger
Debugging Functions


Send comments about this topic to Microsoft

Build date: 1/10/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content      
What's the 64-bit Variant?      ddaS-edEn ... Sandu Buraga   |   Edit   |  

OutputDebugString() doesn't seem to work on Vista 64-bit .

Is there a variant for Vista x64 that works similar to the Win32 OutputDebugString()?

I want to use the DebugView 4.64 to capture debug output on Vista x64 .

OK. GOT IT.!!

This is the SOLUTION:

In DebugView 4.64 , make sure that Capture Global Win32 is enabled. To do this, in the DebugView 4.64 main menu go to Capture and see if the Capture Global Win32 item is checked. If not, check it.

Upon doing this, you'll notice that OutputDebugString() output appears in DebugView 4.64 on Vista x64 . :)

The same problem is on Windows 2003 SP1 and R2 and it can be fixed in the same manner, this comment would be useful also for the .net developers (see System.Diagnostics Debug and Trace classes).

Tags What's this?: Add a tag
Flag as ContentBug
WinDbg does not receive OutputDebugString from Vista      kaichire ... Jacky Kim   |   Edit   |  

I connected Vista as Debuggee to WinDbg(6.6.7.5) bya 1394 and serial.

Connection was successful, But WinDbg does not display OutputDebugString from Debug Mode Vista.

It worked well on Windows XP. What is difference from XP Debug Mode and Visa Debug Mode?

[Answer]

In Vista, certain registry setting is required for Debug String Output.

HKLM\SYSTEM\CCS\Control\Session Manager\Debug Print Filter

Refer to below.

http://www.osronline.com/article.cfm?article=295

Tags What's this?: Add a tag
Flag as ContentBug
Truncating      Jakub Nietrzeba   |   Edit   |  
Does Visual C++ truncating debugger string?
Tags What's this?: Add a tag
Flag as ContentBug
Kernel mode debug messages      Dwayne Robinson   |   Edit   |  
Note that to send a string while in kernel mode (device driver level), you should use DbgPrint/KdPrint. DbgPrintEx also supports message filtering based on the component IDs and severity level.
Tags What's this?: Add a tag
Flag as ContentBug
Implementation details      Austin Donnelly MSFT   |   Edit   |  

For implementation details, see also:

http://www.unixwiz.net/techtips/outputdebugstring.html

Brief summary: one global mutex serialising access, a 4KB shared memory buffer for the string, and a couple of events to signal who "owns" the buffer (reader or writer).

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker