Index: chrome/app/breakpad_mac.mm |
diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm |
index 3838f6337389333de6e0df339341097b35878a6d..dff0e33c26b87ded1558bfd5d1a74846e8a2bcec 100644 |
--- a/chrome/app/breakpad_mac.mm |
+++ b/chrome/app/breakpad_mac.mm |
@@ -138,6 +138,24 @@ class DumpHelper : public base::PlatformThread::Delegate { |
DISALLOW_COPY_AND_ASSIGN(DumpHelper); |
}; |
+void SIGABRTHandler(int signal) { |
+ // The OSX abort() (link below) masks all signals for the process, |
+ // and all except SIGABRT for the thread. SIGABRT will be masked |
+ // when the SIGABRT is sent, which means at this point only SIGKILL |
+ // and SIGSTOP can be delivered. Unmask others so that the code |
+ // below crashes as desired. |
+ // |
+ // http://www.opensource.apple.com/source/Libc/Libc-825.26/stdlib/FreeBSD/abort.c |
+ sigset_t mask; |
+ sigemptyset(&mask); |
+ sigaddset(&mask, signal); |
+ pthread_sigmask(SIG_SETMASK, &mask, NULL); |
+ |
+ // Most interesting operations are not safe in a signal handler, just crash. |
+ char* volatile death_ptr = NULL; |
+ *death_ptr = '!'; |
+} |
+ |
} // namespace |
bool IsCrashReporterEnabled() { |
@@ -274,6 +292,14 @@ void InitCrashReporter() { |
logging::SetLogMessageHandler(&FatalMessageHandler); |
logging::SetDumpWithoutCrashingFunction(&DumpHelper::DumpWithoutCrashing); |
+ |
+ // abort() sends SIGABRT, which breakpad does not intercept. |
+ // Register a signal handler to crash in a way breakpad will |
+ // intercept. |
Nico
2013/05/23 21:27:50
Why doesn't breakpad do that?
Scott Hess - ex-Googler
2013/05/23 21:32:59
One day on the bug, Mark said "Mac Breakpad doesn’
|
+ struct sigaction sigact; |
+ memset(&sigact, 0, sizeof(sigact)); |
+ sigact.sa_handler = SIGABRTHandler; |
+ CHECK(0 == sigaction(SIGABRT, &sigact, NULL)); |
} |
void InitCrashProcessInfo() { |