1
by brian
clean slate |
1 |
/*********************************************************************
|
2 |
Debug utilities for Innobase.
|
|
3 |
||
4 |
(c) 1994, 1995 Innobase Oy
|
|
5 |
||
6 |
Created 1/30/1994 Heikki Tuuri
|
|
7 |
**********************************************************************/
|
|
8 |
||
9 |
#include "univ.i" |
|
10 |
||
11 |
#if defined(__GNUC__) && (__GNUC__ > 2)
|
|
12 |
#else
|
|
13 |
/* This is used to eliminate compiler warnings */
|
|
14 |
ulint ut_dbg_zero = 0; |
|
15 |
#endif
|
|
16 |
||
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
|
|
19 |
and assert */
|
|
20 |
ibool ut_dbg_stop_threads = FALSE; |
|
21 |
#endif
|
|
51.3.12
by Jay Pipes
Removed remaining NETWARE references and conditionals from InnoDB |
22 |
#if !defined(UT_DBG_USE_ABORT)
|
1
by brian
clean slate |
23 |
/* Null pointer used to generate memory trap */
|
24 |
||
25 |
ulint* ut_dbg_null_ptr = NULL; |
|
26 |
#endif
|
|
27 |
||
28 |
/*****************************************************************
|
|
29 |
Report a failed assertion. */
|
|
30 |
||
31 |
void
|
|
32 |
ut_dbg_assertion_failed( |
|
33 |
/*====================*/
|
|
34 |
const char* expr, /* in: the failed assertion (optional) */ |
|
35 |
const char* file, /* in: source file containing the assertion */ |
|
36 |
ulint line) /* in: line number of the assertion */ |
|
37 |
{
|
|
38 |
ut_print_timestamp(stderr); |
|
39 |
fprintf(stderr, |
|
40 |
" InnoDB: Assertion failure in thread %lu"
|
|
41 |
" in file %s line %lu\n", |
|
42 |
os_thread_pf(os_thread_get_curr_id()), file, line); |
|
43 |
if (expr) { |
|
44 |
fprintf(stderr, |
|
45 |
"InnoDB: Failing assertion: %s\n", expr); |
|
46 |
}
|
|
47 |
||
48 |
fputs("InnoDB: We intentionally generate a memory trap.\n" |
|
49 |
"InnoDB: Submit a detailed bug report"
|
|
50 |
" to http://bugs.mysql.com.\n" |
|
51 |
"InnoDB: If you get repeated assertion failures"
|
|
52 |
" or crashes, even\n" |
|
53 |
"InnoDB: immediately after the mysqld startup, there may be\n" |
|
54 |
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n" |
|
55 |
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
|
|
56 |
"forcing-recovery.html\n" |
|
57 |
"InnoDB: about forcing recovery.\n", stderr); |
|
58 |
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
|
|
59 |
ut_dbg_stop_threads = TRUE; |
|
60 |
#endif
|
|
61 |
}
|
|
62 |
||
63 |
# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
|
|
64 |
/*****************************************************************
|
|
65 |
Stop a thread after assertion failure. */
|
|
66 |
||
67 |
void
|
|
68 |
ut_dbg_stop_thread( |
|
69 |
/*===============*/
|
|
70 |
const char* file, |
|
71 |
ulint line) |
|
72 |
{
|
|
73 |
fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n", |
|
74 |
os_thread_pf(os_thread_get_curr_id()), file, line); |
|
75 |
os_thread_sleep(1000000000); |
|
76 |
}
|
|
77 |
# endif
|