#At file:///net/atum21.norway/export/home/tmp/ss156133/z/47391-50/ based on revid:frazer@stripped
2817 Staale Smedseng 2009-10-16
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). The symbol
names are mangled, so use of c++filt may be required as
described in the MySQL documentation.
modified:
sql/stacktrace.c
sql/stacktrace.h
=== modified file 'sql/stacktrace.c'
--- a/sql/stacktrace.c 2008-09-16 11:16:41 +0000
+++ b/sql/stacktrace.c 2009-10-16 11:20:03 +0000
@@ -226,6 +226,23 @@ 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\n\
+stack trace is much more helpful in diagnosing the problem, so please do \n\
+resolve it\n");
+}
+
#endif /* TARGET_OS_LINUX */
#endif /* HAVE_STACKTRACE */
=== modified file 'sql/stacktrace.h'
--- a/sql/stacktrace.h 2008-02-19 11:37:39 +0000
+++ b/sql/stacktrace.h 2009-10-16 11:20:03 +0000
@@ -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
Attachment: [text/bzr-bundle] bzr/staale.smedseng@sun.com-20091016112003-0l7f2qlbm7ktdai3.bundle