summaryrefslogtreecommitdiff
path: root/sql/signal_handler.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-02-21 09:36:48 +0200
committerMichael Widenius <monty@askmonty.org>2012-02-21 09:36:48 +0200
commitdf9d8477454cf65e886dac5e88ec9bbf0291190f (patch)
tree07cbf3704257e0d687828e17905c6170a59bea38 /sql/signal_handler.cc
parent15c5a2686f6367d5a280813ad96ef86bd0ee0fc0 (diff)
parentbebf3d1d8ba927ca39c00608da2028e61ffd32b9 (diff)
downloadmariadb-git-df9d8477454cf65e886dac5e88ec9bbf0291190f.tar.gz
Automatic merge
Diffstat (limited to 'sql/signal_handler.cc')
-rw-r--r--sql/signal_handler.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index 2d6f22d2658..819b87e3fdc 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -28,7 +28,7 @@
#endif
/*
- We are handling signals in this file.
+ We are handling signals/exceptions in this file.
Any global variables we read should be 'volatile sig_atomic_t'
to guarantee that we read some consistent value.
*/
@@ -40,20 +40,18 @@ extern volatile sig_atomic_t ld_assume_kernel_is_set;
#endif
/**
- * Handler for fatal signals
+ * Handler for fatal signals on POSIX, exception handler on Windows.
*
* Fatal events (seg.fault, bus error etc.) will trigger
* this signal handler. The handler will try to dump relevant
* debugging information to stderr and dump a core image.
*
- * Signal handlers can only use a set of 'safe' system calls
- * and library functions. A list of safe calls in POSIX systems
+ * POSIX : Signal handlers should, if possible, only use a set of 'safe' system
+ * calls and library functions. A list of safe calls in POSIX systems
* are available at:
* http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html
- * For MS Windows, guidelines are available at:
- * http://msdn.microsoft.com/en-us/library/xdkz3x12(v=vs.71).aspx
*
- * @param sig Signal number
+ * @param sig Signal number /Exception code
*/
extern "C" sig_handler handle_fatal_signal(int sig)
{
@@ -77,7 +75,13 @@ extern "C" sig_handler handle_fatal_signal(int sig)
my_safe_printf_stderr("%02d%02d%02d %2d:%02d:%02d ",
tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);
- if (opt_expect_abort && sig == SIGABRT)
+ if (opt_expect_abort
+#ifdef _WIN32
+ && sig == EXCEPTION_BREAKPOINT /* __debugbreak in my_sigabrt_hander() */
+#else
+ && sig == SIGABRT
+#endif
+ )
{
fprintf(stderr,"[Note] mysqld did an expected abort\n");
goto end;
@@ -88,10 +92,10 @@ extern "C" sig_handler handle_fatal_signal(int sig)
my_safe_printf_stderr("%s",
"This could be because you hit a bug. It is also possible that this binary\n"
"or one of the libraries it was linked against is corrupt, improperly built,\n"
- "or misconfigured. This error can also be caused by malfunctioning hardware.\n");
+ "or misconfigured. This error can also be caused by malfunctioning hardware.\n\n");
my_safe_printf_stderr("%s",
- "To report this bug, see http://kb.askmonty.org/en/reporting-bugs\n");
+ "To report this bug, see http://kb.askmonty.org/en/reporting-bugs\n\n");
my_safe_printf_stderr("%s",
"We will try our best to scrape up some info that will hopefully help\n"
@@ -276,5 +280,7 @@ end:
On Windows, do not terminate, but pass control to exception filter.
*/
_exit(1); // Using _exit(), since exit() is not async signal safe
+#else
+ return;
#endif
}