summaryrefslogtreecommitdiff
path: root/src/debug.cpp
diff options
context:
space:
mode:
authorCraig Robbins <kde.psych@gmail.com>2015-03-06 20:21:51 +1000
committerCraig Robbins <kde.psych@gmail.com>2015-03-07 22:41:47 +1000
commitced6d20295a8263757d57c02a07ffcb66688a163 (patch)
treea44527357c1ffccb88bf479686735aef168d15c1 /src/debug.cpp
parenta603a767877b94b4d3bc4d3de8d762fbc56a583d (diff)
downloadminetest-ced6d20295a8263757d57c02a07ffcb66688a163.tar.gz
minetest-ced6d20295a8263757d57c02a07ffcb66688a163.tar.bz2
minetest-ced6d20295a8263757d57c02a07ffcb66688a163.zip
For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives
Diffstat (limited to 'src/debug.cpp')
-rw-r--r--src/debug.cpp20
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
*/