summaryrefslogtreecommitdiff
path: root/innobase/ut
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2005-06-10 12:22:23 +0300
committerunknown <marko@hundin.mysql.fi>2005-06-10 12:22:23 +0300
commit7256cdaa563a8248527978acfedd806252cb98be (patch)
tree3a1a1f836b475f0575bd1bb628ba92f35f5f8437 /innobase/ut
parent9db57192c178695e1dc86b58fca408038cfd96b4 (diff)
downloadmariadb-git-7256cdaa563a8248527978acfedd806252cb98be.tar.gz
InnoDB: Improved the handling of assertions.
innobase/include/ut0dbg.h: Write help macros to use in ut_a() and ut_error. Moved some ut_a() and ut_error code to non-inlined functions. Fixed ut_error on NetWare. Reintroduced ut_dbg_zero on non-GCC platforms. innobase/ut/ut0dbg.c: Reintroduced ut_dbg_zero on non-GCC platforms. Removed ut_dbg_null_ptr on NetWare. Add helpers ut_dbg_assertion_failed() and ut_dbg_stop_thread().
Diffstat (limited to 'innobase/ut')
-rw-r--r--innobase/ut/ut0dbg.c54
1 files changed, 47 insertions, 7 deletions
diff --git a/innobase/ut/ut0dbg.c b/innobase/ut/ut0dbg.c
index ea3b48b6e9e..c4d738ffb83 100644
--- a/innobase/ut/ut0dbg.c
+++ b/innobase/ut/ut0dbg.c
@@ -8,6 +8,12 @@ Created 1/30/1994 Heikki Tuuri
#include "univ.i"
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#else
+/* This is used to eliminate compiler warnings */
+ulint ut_dbg_zero = 0;
+#endif
+
/* If this is set to TRUE all threads will stop into the next assertion
and assert */
ibool ut_dbg_stop_threads = FALSE;
@@ -16,21 +22,55 @@ ibool panic_shutdown = FALSE; /* This is set to TRUE when on NetWare there
happens an InnoDB assertion failure or other
fatal error condition that requires an
immediate shutdown. */
-#endif
+#else /* __NETWARE__ */
/* Null pointer used to generate memory trap */
ulint* ut_dbg_null_ptr = NULL;
+#endif /* __NETWARE__ */
-const char* ut_dbg_msg_assert_fail =
-"InnoDB: Assertion failure in thread %lu in file %s line %lu\n";
-const char* ut_dbg_msg_trap =
+/*****************************************************************
+Report a failed assertion. */
+
+void
+ut_dbg_assertion_failed(
+/*====================*/
+ const char* expr, /* in: the failed assertion (optional) */
+ const char* file, /* in: source file containing the assertion */
+ ulint line) /* in: line number of the assertion */
+{
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ "InnoDB: Assertion failure in thread %lu"
+ " in file %s line %lu\n",
+ os_thread_pf(os_thread_get_curr_id()), file, line);
+ if (expr) {
+ fprintf(stderr,
+ "InnoDB: Failing assertion: %s\n", expr);
+ }
+
+ fputs(
"InnoDB: We intentionally generate a memory trap.\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com.\n"
"InnoDB: If you get repeated assertion failures or crashes, even\n"
"InnoDB: immediately after the mysqld startup, there may be\n"
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
-"InnoDB: about forcing recovery.\n";
+"InnoDB: about forcing recovery.\n", stderr);
+ ut_dbg_stop_threads = TRUE;
+}
+
+#ifndef __NETWARE__
+/*****************************************************************
+Stop a thread after assertion failure. */
-const char* ut_dbg_msg_stop =
-"InnoDB: Thread %lu stopped in file %s line %lu\n";
+void
+ut_dbg_stop_thread(
+/*===============*/
+ const char* file,
+ ulint line)
+{
+ fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
+ os_thread_pf(os_thread_get_curr_id()), file, line);
+ os_thread_sleep(1000000000);
+}
+#endif /* __NETWARE__ */