Win32: emit dbp() output to stderr as well in Debug builds.

pull/33/head
whitequark 2016-08-01 00:46:09 +00:00
parent c83421a2b5
commit 14cf0e09df
1 changed files with 8 additions and 2 deletions

View File

@ -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