summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBUILD/compile-solaris-sparc-purify2
-rw-r--r--sql/mysqld.cc8
-rw-r--r--sql/stacktrace.c10
-rw-r--r--sql/stacktrace.h7
4 files changed, 15 insertions, 12 deletions
diff --git a/BUILD/compile-solaris-sparc-purify b/BUILD/compile-solaris-sparc-purify
index 91fbbf1ae8d..8bb53bba876 100755
--- a/BUILD/compile-solaris-sparc-purify
+++ b/BUILD/compile-solaris-sparc-purify
@@ -6,7 +6,7 @@ aclocal && autoheader && aclocal && automake && autoconf
(cd bdb/dist && sh s_all)
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
-CFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_purify -DEXTRA_DEBUG -O2" CXX=gcc CXXLD=g++ CXXFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_purify -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-berkeley-db --with-innodb
+CFLAGS="-g -Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_purify -DEXTRA_DEBUG -O2" CXX=gcc CXXLD=g++ CXXFLAGS="-g -Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_purify -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-berkeley-db --with-innodb
gmake -j 4
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 35aeaecc6e1..b484eee3480 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1247,12 +1247,14 @@ static void init_signals(void)
sigset(THR_KILL_SIGNAL,end_thread_signal);
sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
- struct sigaction sa; sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL))
{
+ struct sigaction sa;
+ sa.sa_flags = SA_RESETHAND | SA_NODEFER;
+ sigemptyset(&sa.sa_mask);
+ sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
+
init_stacktrace();
sa.sa_handler=handle_segfault;
sigaction(SIGSEGV, &sa, NULL);
diff --git a/sql/stacktrace.c b/sql/stacktrace.c
index ab1113f74cf..408006dac93 100644
--- a/sql/stacktrace.c
+++ b/sql/stacktrace.c
@@ -205,11 +205,17 @@ resolve it\n");
/* Produce a core for the thread */
-#ifdef HAVE_WRITE_CORE
+#ifdef HAVE_LINUXTHREADS
void write_core(int sig)
{
signal(sig, SIG_DFL);
if (fork() != 0) exit(1); // Abort main program
// Core will be written at exit
}
-#endif /* HAVE_WRITE_CORE */
+#else
+void write_core(int sig)
+{
+ signal(sig, SIG_DFL);
+ pthread_kill(pthread_self(), sig);
+}
+#endif
diff --git a/sql/stacktrace.h b/sql/stacktrace.h
index b6c0ec43a0f..980e1ea07eb 100644
--- a/sql/stacktrace.h
+++ b/sql/stacktrace.h
@@ -30,9 +30,6 @@ extern char* heap_start;
void print_stacktrace(gptr stack_bottom, ulong thread_stack);
void safe_print_str(const char* name, const char* val, int max_len);
#endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
-
-#define HAVE_WRITE_CORE
-void write_core(int sig);
#endif /* HAVE_LINUXTHREADS */
/* Define empty prototypes for functions that are not implemented */
@@ -42,9 +39,7 @@ void write_core(int sig);
#define safe_print_str(A,B,C) {}
#endif /* HAVE_STACKTRACE */
-#ifndef HAVE_WRITE_CORE
-#define write_core(A) {}
-#endif
+void write_core(int sig);
#ifdef __cplusplus
}