diff options
Diffstat (limited to 'sql/stacktrace.c')
-rw-r--r-- | sql/stacktrace.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/sql/stacktrace.c b/sql/stacktrace.c index 77e7707592d..40507907120 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -2,8 +2,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -54,21 +53,6 @@ void safe_print_str(const char* name, const char* val, int max_len) #define SIGRETURN_FRAME_OFFSET 23 #endif -static my_bool is_nptl; - -/* Check if we are using NPTL or LinuxThreads on Linux */ -void check_thread_lib(void) -{ - char buf[5]; - -#ifdef _CS_GNU_LIBPTHREAD_VERSION - confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf)); - is_nptl = !strncasecmp(buf, "NPTL", sizeof(buf)); -#else - is_nptl = 0; -#endif -} - #if defined(__alpha__) && defined(__GNUC__) /* The only way to backtrace without a symbol table on alpha @@ -110,7 +94,7 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp) #endif /* defined(__alpha__) && defined(__GNUC__) */ -void print_stacktrace(gptr stack_bottom, ulong thread_stack) +void print_stacktrace(uchar* stack_bottom, ulong thread_stack) { uchar** fp; uint frame_count = 0, sigreturn_frame_count; @@ -145,11 +129,11 @@ terribly wrong...\n"); return; } - if (!stack_bottom || (gptr) stack_bottom > (gptr) &fp) + if (!stack_bottom || (uchar*) stack_bottom > (uchar*) &fp) { ulong tmp= min(0x10000,thread_stack); /* Assume that the stack starts at the previous even 65K */ - stack_bottom= (gptr) (((ulong) &fp + tmp) & + stack_bottom= (uchar*) (((ulong) &fp + tmp) & ~(ulong) 0xFFFF); fprintf(stderr, "Cannot determine thread, fp=%p, backtrace may not be correct.\n", fp); } @@ -174,8 +158,8 @@ terribly wrong...\n"); #endif /* __alpha__ */ /* We are 1 frame above signal frame with NPTL and 2 frames above with LT */ - sigreturn_frame_count = is_nptl ? 1 : 2; - + sigreturn_frame_count = thd_lib_detected == THD_LIB_LT ? 2 : 1; + while (fp < (uchar**) stack_bottom) { #if defined(__i386__) || defined(__x86_64__) @@ -222,9 +206,11 @@ terribly wrong...\n"); fprintf(stderr, "Stack trace seems successful - bottom reached\n"); end: - fprintf(stderr, "Please read http://dev.mysql.com/doc/mysql/en/using-stack-trace.html and follow instructions on how to resolve the stack trace. Resolved\n\ -stack trace is much more helpful in diagnosing the problem, so please do \n\ -resolve it\n"); + fprintf(stderr, + "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" + "Resolved stack trace is much more helpful in diagnosing the\n" + "problem, so please do resolve it\n"); } #endif /* TARGET_OS_LINUX */ #endif /* HAVE_STACKTRACE */ |