diff options
-rw-r--r-- | innobase/include/ut0dbg.h | 52 | ||||
-rw-r--r-- | innobase/ut/ut0dbg.c | 13 |
2 files changed, 25 insertions, 40 deletions
diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h index fd543dc5649..9b07d5da488 100644 --- a/innobase/include/ut0dbg.h +++ b/innobase/include/ut0dbg.h @@ -20,50 +20,34 @@ extern ibool ut_dbg_stop_threads; extern ulint* ut_dbg_null_ptr; +extern const char* ut_dbg_msg_assert_fail; +extern const char* ut_dbg_msg_trap; +extern const char* ut_dbg_msg_stop; + #define ut_a(EXPR)\ -{\ - ulint dbg_i;\ -\ if (!((ulint)(EXPR) + ut_dbg_zero)) {\ ut_print_timestamp(stderr);\ - fprintf(stderr,\ - " InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\ + fprintf(stderr, ut_dbg_msg_assert_fail,\ os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\ (ulint)__LINE__);\ - fputs(\ - "InnoDB: Failing assertion: " #EXPR, stderr);\ - fprintf(stderr,\ - "\nInnoDB: We intentionally generate a memory trap.\n");\ - fprintf(stderr,\ - "InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n");\ + fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\ + fputs(ut_dbg_msg_trap, stderr);\ ut_dbg_stop_threads = TRUE;\ - dbg_i = *(ut_dbg_null_ptr);\ - if (dbg_i) {\ - ut_dbg_null_ptr = NULL;\ - }\ + (*ut_dbg_null_ptr)++;\ }\ if (ut_dbg_stop_threads) {\ - fprintf(stderr,\ - "InnoDB: Thread %lu stopped in file %s line %lu\n",\ + fprintf(stderr, ut_dbg_msg_stop,\ os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\ os_thread_sleep(1000000000);\ - }\ -} - -#define ut_error {\ - ulint dbg_i;\ - 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()), IB__FILE__, (ulint)__LINE__);\ - fprintf(stderr,\ - "InnoDB: We intentionally generate a memory trap.\n");\ - fprintf(stderr,\ - "InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n");\ - ut_dbg_stop_threads = TRUE;\ - dbg_i = *(ut_dbg_null_ptr);\ - printf("%lu", dbg_i);\ -} + } + +#define ut_error\ + ut_print_timestamp(stderr);\ + fprintf(stderr, ut_dbg_msg_assert_fail,\ + os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\ + fprintf(stderr, ut_dbg_msg_trap);\ + ut_dbg_stop_threads = TRUE;\ + (*ut_dbg_null_ptr)++; #ifdef UNIV_DEBUG #define ut_ad(EXPR) ut_a(EXPR) diff --git a/innobase/ut/ut0dbg.c b/innobase/ut/ut0dbg.c index 970dd501fad..6cd0ed62454 100644 --- a/innobase/ut/ut0dbg.c +++ b/innobase/ut/ut0dbg.c @@ -19,9 +19,10 @@ ibool ut_dbg_stop_threads = FALSE; ulint* ut_dbg_null_ptr = NULL; -/* Dummy function to prevent gcc from ignoring this file */ -void -ut_dummy(void) -{ - printf("Hello world\n"); -} +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 = +"InnoDB: We intentionally generate a memory trap.\n" +"InnoDB: Send a detailed bug report to mysql@lists.mysql.com.\n"; +const char* ut_dbg_msg_stop = +"InnoDB: Thread %lu stopped in file %s line %lu\n"; |