17
17
*****************************************************************************/
19
/*********************************************************************
19
/*****************************************************************//**
20
21
Debug utilities for Innobase.
22
23
Created 1/30/1994 Heikki Tuuri
28
29
#if defined(__GNUC__) && (__GNUC__ > 2)
30
/* This is used to eliminate compiler warnings */
31
/** This is used to eliminate compiler warnings */
31
32
UNIV_INTERN ulint ut_dbg_zero = 0;
34
35
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
35
/* If this is set to TRUE all threads will stop into the next assertion
36
/** If this is set to TRUE by ut_dbg_assertion_failed(), all threads
37
will stop at the next ut_a() or ut_ad(). */
37
38
UNIV_INTERN ibool ut_dbg_stop_threads = FALSE;
40
/* This is set to TRUE when on NetWare there happens an InnoDB
41
assertion failure or other fatal error condition that requires an
42
immediate shutdown. */
41
/** Flag for ignoring further assertion failures. This is set to TRUE
42
when on NetWare there happens an InnoDB assertion failure or other
43
fatal error condition that requires an immediate shutdown. */
43
44
UNIV_INTERN ibool panic_shutdown = FALSE;
44
45
#elif !defined(UT_DBG_USE_ABORT)
45
/* Null pointer used to generate memory trap */
46
/** A null pointer that will be dereferenced to trigger a memory trap */
46
47
UNIV_INTERN ulint* ut_dbg_null_ptr = NULL;
49
/*****************************************************************
50
/*************************************************************//**
50
51
Report a failed assertion. */
53
54
ut_dbg_assertion_failed(
54
55
/*====================*/
55
const char* expr, /* in: the failed assertion (optional) */
56
const char* file, /* in: source file containing the assertion */
57
ulint line) /* in: line number of the assertion */
56
const char* expr, /*!< in: the failed assertion (optional) */
57
const char* file, /*!< in: source file containing the assertion */
58
ulint line) /*!< in: line number of the assertion */
59
60
ut_print_timestamp(stderr);
62
fprintf(stderr, " InnoDB: Assertion failure in file %s line %lu\n",
64
#else /* UNIV_HOTBACKUP */
61
66
" InnoDB: Assertion failure in thread %lu"
62
67
" in file %s line %lu\n",
63
68
os_thread_pf(os_thread_get_curr_id()), file, line);
69
#endif /* UNIV_HOTBACKUP */
66
72
"InnoDB: Failing assertion: %s\n", expr);
73
79
" or crashes, even\n"
74
80
"InnoDB: immediately after the mysqld startup, there may be\n"
75
81
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
76
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
77
"forcing-recovery.html\n"
82
"InnoDB: " REFMAN "forcing-recovery.html\n"
78
83
"InnoDB: about forcing recovery.\n", stderr);
79
84
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
80
85
ut_dbg_stop_threads = TRUE;
106
111
const char* file,
114
#ifndef UNIV_HOTBACKUP
109
115
fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
110
116
os_thread_pf(os_thread_get_curr_id()), file, line);
111
117
os_thread_sleep(1000000000);
118
#endif /* !UNIV_HOTBACKUP */
114
121
#endif /* __NETWARE__ */
134
141
#endif /* timersub */
136
/***********************************************************************
143
/*******************************************************************//**
137
144
Resets a speedo (records the current time in it). */
142
speedo_t* speedo) /* out: speedo */
149
speedo_t* speedo) /*!< out: speedo */
144
151
gettimeofday(&speedo->tv, NULL);
146
153
getrusage(RUSAGE_SELF, &speedo->ru);
149
/***********************************************************************
156
/*******************************************************************//**
150
157
Shows the time elapsed and usage statistics since the last reset of a
156
const speedo_t* speedo) /* in: speedo */
163
const speedo_t* speedo) /*!< in: speedo */
158
165
struct rusage ru_now;
159
166
struct timeval tv_now;