diff options
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/mf_keycache.c | 25 | ||||
-rw-r--r-- | mysys/my_init.c | 2 | ||||
-rw-r--r-- | mysys/stacktrace.c | 16 | ||||
-rw-r--r-- | mysys/thr_alarm.c | 3 | ||||
-rw-r--r-- | mysys/thr_lock.c | 2 |
5 files changed, 28 insertions, 20 deletions
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 34aeb569faf..c7fc2fbb84f 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -421,11 +421,12 @@ static int keycache_pthread_cond_signal(mysql_cond_t *cond); #undef inline #endif #define inline /* disabled inline for easier debugging */ -static int fail_block(BLOCK_LINK *block); static int fail_hlink(HASH_LINK *hlink); static int cache_empty(SIMPLE_KEY_CACHE_CB *keycache); #endif - +#ifdef DBUG_ASSERT_EXISTS +static int fail_block(BLOCK_LINK *block); +#endif static inline uint next_power(uint value) { @@ -713,7 +714,7 @@ int prepare_resize_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, res= 1; goto finish; } - DBUG_ASSERT(cache_empty(keycache)); + DBUG_SLOW_ASSERT(cache_empty(keycache)); /* End the flush phase. */ keycache->resize_in_flush= 0; @@ -1088,7 +1089,7 @@ static void unlink_from_queue(KEYCACHE_WQUEUE *wqueue, thread->prev); } thread->next= NULL; -#if !defined(DBUG_OFF) +#ifdef DBUG_ASSERT_EXISTS /* This makes it easier to see it's not in a chain during debugging. And some DBUG_ASSERT() rely on it. @@ -1211,7 +1212,7 @@ static inline void unlink_changed(BLOCK_LINK *block) block->next_changed->prev_changed= block->prev_changed; *block->prev_changed= block->next_changed; -#if !defined(DBUG_OFF) +#ifdef DBUG_ASSERT_EXISTS /* This makes it easier to see it's not in a chain during debugging. And some DBUG_ASSERT() rely on it. @@ -1497,7 +1498,7 @@ static void unlink_block(SIMPLE_KEY_CACHE_CB *keycache, BLOCK_LINK *block) keycache->used_ins=STRUCT_PTR(BLOCK_LINK, next_used, block->prev_used); } block->next_used= NULL; -#if !defined(DBUG_OFF) +#ifdef DBUG_ASSERT_EXISTS /* This makes it easier to see it's not in a chain during debugging. And some DBUG_ASSERT() rely on it. @@ -4309,10 +4310,8 @@ restart: } /* if (keycache->disk_blocks > 0 */ -#ifndef DBUG_OFF DBUG_EXECUTE("check_keycache", test_key_cache(keycache, "end of flush_key_blocks", 0);); -#endif err: if (cache != cache_buff) my_free(cache); @@ -4790,11 +4789,12 @@ void keycache_debug_log_close(void) #endif /* defined(KEYCACHE_DEBUG) */ -#if !defined(DBUG_OFF) +#ifdef DBUG_ASSERT_EXISTS #define F_B_PRT(_f_, _v_) DBUG_PRINT("assert_fail", (_f_, _v_)) -static int fail_block(BLOCK_LINK *block) +static int fail_block(BLOCK_LINK *block __attribute__((unused))) { +#ifndef DBUG_OFF F_B_PRT("block->next_used: %lx\n", (ulong) block->next_used); F_B_PRT("block->prev_used: %lx\n", (ulong) block->prev_used); F_B_PRT("block->next_changed: %lx\n", (ulong) block->next_changed); @@ -4805,10 +4805,13 @@ static int fail_block(BLOCK_LINK *block) F_B_PRT("block->offset: %u\n", block->offset); F_B_PRT("block->requests: %u\n", block->requests); F_B_PRT("block->temperature: %u\n", block->temperature); +#endif return 0; /* Let the assert fail. */ } +#endif -static int fail_hlink(HASH_LINK *hlink) +#ifndef DBUG_OFF +static int fail_hlink(HASH_LINK *hlink __attribute__((unused))) { F_B_PRT("hlink->next: %lx\n", (ulong) hlink->next); F_B_PRT("hlink->prev: %lx\n", (ulong) hlink->prev); diff --git a/mysys/my_init.c b/mysys/my_init.c index 7f0f7a8cc44..ff9a6913fa2 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -230,7 +230,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", my_init_done= my_thr_key_mysys_exists= 0; } /* my_end */ -#ifndef DBUG_OFF +#ifdef DBUG_ASSERT_EXISTS /* Dummy tag function for debugging */ void my_debug_put_break_here(void) diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 841a52944df..5d7fa321ce5 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -178,12 +178,13 @@ int my_safe_print_str(const char* val, int max_len) #include <ucontext.h> void my_print_stacktrace(uchar* stack_bottom __attribute__((unused)), - ulong thread_stack __attribute__((unused))) + ulong thread_stack __attribute__((unused)), + my_bool silent) { if (printstack(fileno(stderr)) == -1) my_safe_printf_stderr("%s", "Error when traversing the stack, stack appears corrupt.\n"); - else + else if (!silent) my_safe_printf_stderr("%s", "Please read " "http://dev.mysql.com/doc/refman/5.1/en/resolve-stack-dump.html\n" @@ -260,7 +261,8 @@ static int print_with_addr_resolve(void **addrs, int n) } #endif -void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack) +void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack, + my_bool silent __attribute__((unused))) { void *addrs[128]; char **strings __attribute__((unused)) = NULL; @@ -334,7 +336,8 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp) } #endif /* defined(__alpha__) && defined(__GNUC__) */ -void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack) +void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack, + my_bool silent) { uchar** UNINIT_VAR(fp); uint frame_count = 0, sigreturn_frame_count; @@ -449,7 +452,8 @@ void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack) "Stack trace seems successful - bottom reached\n"); end: - my_safe_printf_stderr("%s", + if (!silent) + my_safe_printf_stderr("%s", "Please read " "http://dev.mysql.com/doc/refman/5.1/en/resolve-stack-dump.html\n" "and follow instructions on how to resolve the stack trace.\n" @@ -610,7 +614,7 @@ static void get_symbol_path(char *path, size_t size) #define SYMOPT_NO_PROMPTS 0 #endif -void my_print_stacktrace(uchar* unused1, ulong unused2) +void my_print_stacktrace(uchar* unused1, ulong unused2, my_bool silent) { HANDLE hProcess= GetCurrentProcess(); HANDLE hThread= GetCurrentThread(); diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 9d917d3dd59..a101c23be58 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -261,7 +261,8 @@ void thr_end_alarm(thr_alarm_t *alarmed) alarm_data= (ALARM*) ((uchar*) *alarmed - offsetof(ALARM,alarmed)); mysql_mutex_lock(&LOCK_alarm); DBUG_ASSERT(alarm_data->index_in_queue != 0); - DBUG_ASSERT(queue_element(&alarm_queue, alarm_data->index_in_queue) == + DBUG_ASSERT((ALARM*) queue_element(&alarm_queue, + alarm_data->index_in_queue) == alarm_data); queue_remove(&alarm_queue, alarm_data->index_in_queue); mysql_mutex_unlock(&LOCK_alarm); diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 6cb9d6af13d..56ac5298da7 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -1541,7 +1541,7 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *in_data, enum thr_lock_type new_lock_type) { THR_LOCK *lock=in_data->lock; -#ifndef DBUG_OFF +#ifdef DBUG_ASSERT_EXISTS enum thr_lock_type old_lock_type= in_data->type; #endif DBUG_ENTER("thr_downgrade_write_only_lock"); |