Index: base/test_suite.h |
diff --git a/base/test_suite.h b/base/test_suite.h |
index 236c3edcbc98ac223e2dd72ebe6ad2da8a20ba5d..80f11009e344137339c554b14a97fdd3c3976841 100644 |
--- a/base/test_suite.h |
+++ b/base/test_suite.h |
@@ -13,6 +13,7 @@ |
#include "base/base_paths.h" |
#include "base/command_line.h" |
#include "base/debug_on_start.h" |
+#include "base/debug_util.h" |
#include "base/file_path.h" |
#include "base/icu_util.h" |
#include "base/logging.h" |
@@ -34,6 +35,13 @@ |
#include <gtk/gtk.h> |
#endif |
+#if defined(OS_POSIX) |
+static void TestSuiteCrashHandler(int signal) { |
+ StackTrace().PrintBacktrace(); |
agl
2009/09/03 17:36:33
Note that, if the crash happens at certain points,
|
+ _exit(1); |
+} |
+#endif |
+ |
class TestSuite { |
public: |
TestSuite(int argc, char** argv) { |
@@ -124,6 +132,11 @@ class TestSuite { |
action.sa_flags = 0; |
sigemptyset(&action.sa_mask); |
CHECK(sigaction(SIGPIPE, &action, NULL) == 0); |
+ |
+ // TODO(phajdan.jr): Catch other crashy signals, like SIGABRT. |
+ CHECK(signal(SIGSEGV, &TestSuiteCrashHandler) != SIG_ERR); |
+ CHECK(signal(SIGILL, &TestSuiteCrashHandler) != SIG_ERR); |
+ CHECK(signal(SIGBUS, &TestSuiteCrashHandler) != SIG_ERR); |
agl
2009/09/03 17:36:33
SIGFPE is probably good too.
|
#endif // OS_POSIX |
#if defined(OS_WIN) |