Mesa (gallium-0.1): util: don' t swallow debug output when running on console

Keith Whitwell keithw at kemper.freedesktop.org
Fri Aug 28 17:38:40 UTC 2009


Module: Mesa
Branch: gallium-0.1
Commit: c0c1f3ce2ada6e9a37e0e5f16b49fc7d2cd4f084
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c0c1f3ce2ada6e9a37e0e5f16b49fc7d2cd4f084

Author: Keith Whitwell <keithw at vmware.com>
Date:   Fri Aug 28 15:54:13 2009 +0100

util: don't swallow debug output when running on console

---

 src/gallium/auxiliary/util/p_debug.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c
index 125f3da..be50e19 100644
--- a/src/gallium/auxiliary/util/p_debug.c
+++ b/src/gallium/auxiliary/util/p_debug.c
@@ -42,6 +42,7 @@
 #define WIN32_LEAN_AND_MEAN      // Exclude rarely-used stuff from Windows headers
 #endif
 #include <windows.h>
+#include <stdio.h>
 
 #else
 
@@ -50,6 +51,7 @@
 
 #endif
 
+
 #include "pipe/p_compiler.h" 
 #include "pipe/p_debug.h" 
 #include "pipe/p_format.h" 
@@ -98,6 +100,15 @@ void _debug_vprintf(const char *format, va_list ap)
       OutputDebugStringA(buf);
       buf[0] = '\0';
    }
+
+   
+   if(GetConsoleWindow() && !IsDebuggerPresent()) {
+      fflush(stdout);
+      vfprintf(stderr, format, ap);
+      fflush(stderr);
+   }
+   
+
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_CE) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) 
    /* TODO */
 #else /* !PIPE_SUBSYSTEM_WINDOWS */




More information about the mesa-commit mailing list