From 14cf0e09df85443951300f8e31be96ee17264c5f Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 1 Aug 2016 00:46:09 +0000 Subject: [PATCH] Win32: emit dbp() output to stderr as well in Debug builds. --- src/platform/w32util.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/platform/w32util.cpp b/src/platform/w32util.cpp index a207ae18..3bdd7ee7 100644 --- a/src/platform/w32util.cpp +++ b/src/platform/w32util.cpp @@ -25,12 +25,18 @@ void dbp(const char *str, ...) // The native version of OutputDebugString, unlike most others, // is OutputDebugStringA. OutputDebugStringA(buf); + +#ifndef NDEBUG + // Duplicate to stderr in debug builds, but not in release; this is slow. + fputs(buf, stderr); + fputc('\n', stderr); +#endif } void assert_failure(const char *file, unsigned line, const char *function, const char *condition, const char *message) { - dbp("File %s, line %u, function %s:\n", file, line, function); - dbp("Assertion '%s' failed: ((%s) == false).\n", message, condition); + dbp("File %s, line %u, function %s:", file, line, function); + dbp("Assertion '%s' failed: ((%s) == false).", message, condition); #ifdef NDEBUG _exit(1); #else