Index: content/public/test/browser_test_base.cc |
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc |
index c6d2e4b6a03c91f8fc0a4adc8ae160b69d20c030..0b510beb8b483eefcdec4d63d0ceac8e1fa3d53e 100644 |
--- a/content/public/test/browser_test_base.cc |
+++ b/content/public/test/browser_test_base.cc |
@@ -62,18 +62,19 @@ namespace content { |
namespace { |
#if defined(OS_POSIX) |
-// On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make |
-// debugging easier) and also exit with a known error code (so that the test |
-// framework considers this a failure -- http://crbug.com/57578). |
+// On SIGSEGV or SIGTERM (sent by the runner on timeouts), dump a stack trace |
+// (to make debugging easier) and also exit with a known error code (so that |
+// the test framework considers this a failure -- http://crbug.com/57578). |
// Note: We only want to do this in the browser process, and not forked |
// processes. That might lead to hangs because of locks inside tcmalloc or the |
// OS. See http://crbug.com/141302. |
static int g_browser_process_pid; |
static void DumpStackTraceSignalHandler(int signal) { |
if (g_browser_process_pid == base::GetCurrentProcId()) { |
- logging::RawLog(logging::LOG_ERROR, |
- "BrowserTestBase signal handler received SIGTERM. " |
- "Backtrace:\n"); |
+ std::string message("BrowserTestBase received signal: "); |
+ message += strsignal(signal); |
+ message += ". Backtrace:\n"; |
+ logging::RawLog(logging::LOG_ERROR, message.c_str()); |
base::debug::StackTrace().Print(); |
} |
_exit(128 + signal); |
@@ -314,10 +315,11 @@ void BrowserTestBase::TearDown() { |
void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { |
#if defined(OS_POSIX) |
- if (handle_sigterm_) { |
- g_browser_process_pid = base::GetCurrentProcId(); |
+ g_browser_process_pid = base::GetCurrentProcId(); |
+ signal(SIGSEGV, DumpStackTraceSignalHandler); |
+ |
+ if (handle_sigterm_) |
signal(SIGTERM, DumpStackTraceSignalHandler); |
- } |
#endif // defined(OS_POSIX) |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |