diff options
Diffstat (limited to 'src/debug.cpp')
-rw-r--r-- | src/debug.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
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 */ |