diff options
author | Staale Smedseng <staale.smedseng@sun.com> | 2009-12-06 18:11:37 +0100 |
---|---|---|
committer | Staale Smedseng <staale.smedseng@sun.com> | 2009-12-06 18:11:37 +0100 |
commit | 63ff2b4c2e7db9872515cec3d897817ac83d109c (patch) | |
tree | 0b38d85b7c8bf26bce8b089ea492bc70e467888f | |
parent | 026541c662539657d75fed5e7e59326abd97cec3 (diff) | |
download | mariadb-git-63ff2b4c2e7db9872515cec3d897817ac83d109c.tar.gz |
Bug #47391 no stack trace printed to error log on
solaris after a crash
This patch adds a Solaris-specific version of
print_stacktrace() which uses printstack(2), available on all
Solaris versions since Solaris 9. (While Solaris 11 adds
support for the glibc functions backtrace_*() as of
PSARC/2007/162, printstack() is used for consistency over all
Solaris versions.)
The symbol names are mangled, so use of c++filt may be
required as described in the MySQL documentation.
sql/stacktrace.c:
Added Solaris-specific print_stacktrace().
-rw-r--r-- | sql/stacktrace.c | 19 | ||||
-rw-r--r-- | sql/stacktrace.h | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sql/stacktrace.c b/sql/stacktrace.c index 4e6ad68c172..295a7a3e1e2 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -226,6 +226,25 @@ end: stack trace is much more helpful in diagnosing the problem, so please do \n\ resolve it\n"); } + +#elif defined(__sun) + +/* Use Solaris' symbolic stack trace routine. */ +#include <ucontext.h> + +void print_stacktrace(gptr stack_bottom __attribute__((unused)), + ulong thread_stack __attribute__((unused))) +{ + if (printstack(fileno(stderr)) == -1) + fprintf(stderr, "Error when traversing the stack, stack appears corrupt.\n"); + else + 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\nstack trace is much more helpful in diagnosing the " + "problem, so please do \nresolve it\n"); +} + #endif /* TARGET_OS_LINUX */ #endif /* HAVE_STACKTRACE */ diff --git a/sql/stacktrace.h b/sql/stacktrace.h index e5e17cc5b9b..718b545b775 100644 --- a/sql/stacktrace.h +++ b/sql/stacktrace.h @@ -35,6 +35,9 @@ void check_thread_lib(void); #define HAVE_STACKTRACE extern void set_exception_pointers(EXCEPTION_POINTERS *ep); #define init_stacktrace() {} +#elif defined(__sun) +#define HAVE_STACKTRACE +#define init_stacktrace() {} #endif #ifdef HAVE_STACKTRACE |