From ced6d20295a8263757d57c02a07ffcb66688a163 Mon Sep 17 00:00:00 2001 From: Craig Robbins Date: Fri, 6 Mar 2015 20:21:51 +1000 Subject: For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives --- src/debug.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/debug.cpp') diff --git a/src/debug.cpp b/src/debug.cpp index bd970a8e4..521891bbd 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -133,11 +133,11 @@ Nullstream dummyout; Assert */ -void assert_fail(const char *assertion, const char *file, +void sanity_check_fn(const char *assertion, const char *file, unsigned int line, const char *function) { DEBUGPRINT("\nIn thread %lx:\n" - "%s:%u: %s: Assertion '%s' failed.\n", + "%s:%u: %s: An engine assumption '%s' failed.\n", (unsigned long)get_current_thread_id(), file, line, function, assertion); @@ -149,6 +149,22 @@ void assert_fail(const char *assertion, const char *file, abort(); } +void fatal_error_fn(const char *msg, const char *file, + unsigned int line, const char *function) +{ + DEBUGPRINT("\nIn thread %lx:\n" + "%s:%u: %s: A fatal error occurred: %s\n", + (unsigned long)get_current_thread_id(), + file, line, function, msg); + + debug_stacks_print(); + + if(g_debugstreams[1]) + fclose(g_debugstreams[1]); + + abort(); +} + /* DebugStack */ -- cgit v1.2.3