aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqsr@chromium.org <qsr@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-05-14 11:34:01 +0000
committerqsr@chromium.org <qsr@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-05-14 11:34:01 +0000
commitbbc3789df1ab5b516cb7186442d66316f00e43bc (patch)
treefea3a939885c7b86b6aa9d6e7873580bba964ba5
parentBits necessary to send the reports along with the minidumps. (diff)
downloadbreakpad-bbc3789df1ab5b516cb7186442d66316f00e43bc.tar.xz
Unprotect the allocator before trying to create a minidump from a signal.
It is impossible to write a minidump with memory protected. This means that before this change, no minidump were created when a signal was caught, instead the application froze. Review URL: https://breakpad.appspot.com/389002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@964 4c0a9323-5329-0410-9bdc-e9ce6186880e
-rw-r--r--src/client/mac/handler/exception_handler.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/client/mac/handler/exception_handler.cc b/src/client/mac/handler/exception_handler.cc
index af319f6c..40430194 100644
--- a/src/client/mac/handler/exception_handler.cc
+++ b/src/client/mac/handler/exception_handler.cc
@@ -485,7 +485,7 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
self->SuspendThreads();
#if USE_PROTECTED_ALLOCATIONS
- if(gBreakpadAllocator)
+ if (gBreakpadAllocator)
gBreakpadAllocator->Unprotect();
#endif
@@ -513,7 +513,7 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
false, false);
#if USE_PROTECTED_ALLOCATIONS
- if(gBreakpadAllocator)
+ if (gBreakpadAllocator)
gBreakpadAllocator->Protect();
#endif
@@ -534,7 +534,7 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
self->SuspendThreads();
#if USE_PROTECTED_ALLOCATIONS
- if(gBreakpadAllocator)
+ if (gBreakpadAllocator)
gBreakpadAllocator->Unprotect();
#endif
@@ -551,14 +551,14 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
// This may have become protected again within
// WriteMinidumpWithException, but it needs to be unprotected for
// UninstallHandler.
- if(gBreakpadAllocator)
+ if (gBreakpadAllocator)
gBreakpadAllocator->Unprotect();
#endif
self->UninstallHandler(true);
#if USE_PROTECTED_ALLOCATIONS
- if(gBreakpadAllocator)
+ if (gBreakpadAllocator)
gBreakpadAllocator->Protect();
#endif
}
@@ -582,6 +582,10 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
//static
void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
+#if USE_PROTECTED_ALLOCATIONS
+ if (gBreakpadAllocator)
+ gBreakpadAllocator->Unprotect();
+#endif
gProtectedData.handler->WriteMinidumpWithException(
EXC_SOFTWARE,
MD_EXCEPTION_CODE_MAC_ABORT,
@@ -589,6 +593,10 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
mach_thread_self(),
true,
true);
+#if USE_PROTECTED_ALLOCATIONS
+ if (gBreakpadAllocator)
+ gBreakpadAllocator->Protect();
+#endif
}
bool ExceptionHandler::InstallHandler() {