summaryrefslogtreecommitdiff
path: root/sql/stacktrace.h
diff options
context:
space:
mode:
authorunknown <davi@mysql.com/endora.local>2008-02-07 19:58:06 -0200
committerunknown <davi@mysql.com/endora.local>2008-02-07 19:58:06 -0200
commitd9831ae5329d6916667ee9beb885c3e4c35c4018 (patch)
tree8ec03724213bdbbf26572c207c4b29a76055757f /sql/stacktrace.h
parentee0b7f38567bf8661d89500b67d115d8a1cb53f8 (diff)
downloadmariadb-git-d9831ae5329d6916667ee9beb885c3e4c35c4018.tar.gz
Bug#31891 Meaningful stack trace
On crashes generate a user-friendly resolved and demangled stack trace when libc provides the necessary functions (newer libc on i386, x86_64, powerpc, ia64, alpha and s390). Otherwise print a numeric stack trace as before, relying on resolve_stack_dump utility. configure.in: Add check for backtrace headers, backtrace functions and if __cxa_demangle (libstdc++) is available at link time. sql/mysqld.cc: Print the value of the THD::killed variable when dumping. In some circumstances knowing if the thread was killed makes debugging easier. sql/stacktrace.c: Use the glibc backtrace function when available and demangle C++ function names if the __cxa_demangle function is available. sql/stacktrace.h: Locally export and wrap in C linkage the C++ function __cxa_demangle if available.
Diffstat (limited to 'sql/stacktrace.h')
-rw-r--r--sql/stacktrace.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/stacktrace.h b/sql/stacktrace.h
index 1a0b80c88d3..96c09a21ad6 100644
--- a/sql/stacktrace.h
+++ b/sql/stacktrace.h
@@ -17,6 +17,14 @@
extern "C" {
#endif
+#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE
+#define BACKTRACE_DEMANGLE 1
+#endif
+
+#if BACKTRACE_DEMANGLE
+char *my_demangle(const char *mangled_name, int *status);
+#endif
+
#ifdef TARGET_OS_LINUX
#if defined(HAVE_STACKTRACE) || (defined (__x86_64__) || defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
#undef HAVE_STACKTRACE