1
/*********************************************************************
2
Debug utilities for Innobase.
4
(c) 1994, 1995 Innobase Oy
6
Created 1/30/1994 Heikki Tuuri
7
**********************************************************************/
11
#if defined(__GNUC__) && (__GNUC__ > 2)
13
/* This is used to eliminate compiler warnings */
14
ulint ut_dbg_zero = 0;
17
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
18
/* If this is set to TRUE all threads will stop into the next assertion
20
ibool ut_dbg_stop_threads = FALSE;
23
ibool panic_shutdown = FALSE; /* This is set to TRUE when on NetWare there
24
happens an InnoDB assertion failure or other
25
fatal error condition that requires an
26
immediate shutdown. */
27
#elif !defined(UT_DBG_USE_ABORT)
28
/* Null pointer used to generate memory trap */
30
ulint* ut_dbg_null_ptr = NULL;
33
/*****************************************************************
34
Report a failed assertion. */
37
ut_dbg_assertion_failed(
38
/*====================*/
39
const char* expr, /* in: the failed assertion (optional) */
40
const char* file, /* in: source file containing the assertion */
41
ulint line) /* in: line number of the assertion */
43
ut_print_timestamp(stderr);
45
" InnoDB: Assertion failure in thread %lu"
46
" in file %s line %lu\n",
47
os_thread_pf(os_thread_get_curr_id()), file, line);
50
"InnoDB: Failing assertion: %s\n", expr);
53
fputs("InnoDB: We intentionally generate a memory trap.\n"
54
"InnoDB: Submit a detailed bug report"
55
" to http://bugs.mysql.com.\n"
56
"InnoDB: If you get repeated assertion failures"
58
"InnoDB: immediately after the mysqld startup, there may be\n"
59
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
60
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
61
"forcing-recovery.html\n"
62
"InnoDB: about forcing recovery.\n", stderr);
63
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
64
ut_dbg_stop_threads = TRUE;
69
/*****************************************************************
70
Shut down MySQL/InnoDB after assertion failure. */
76
if (!panic_shutdown) {
77
panic_shutdown = TRUE;
78
innobase_shutdown_for_mysql();
82
#else /* __NETWARE__ */
83
# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
84
/*****************************************************************
85
Stop a thread after assertion failure. */
93
fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
94
os_thread_pf(os_thread_get_curr_id()), file, line);
95
os_thread_sleep(1000000000);
98
#endif /* __NETWARE__ */