aboutsummaryrefslogtreecommitdiff
path: root/src/client/mac
diff options
context:
space:
mode:
authorladderbreaker <ladderbreaker@4c0a9323-5329-0410-9bdc-e9ce6186880e>2007-08-29 21:28:46 +0000
committerladderbreaker <ladderbreaker@4c0a9323-5329-0410-9bdc-e9ce6186880e>2007-08-29 21:28:46 +0000
commitd792274003fb0e7145161a290eff6d090a934bce (patch)
tree61357a61f95b4b7a41766fce7a675424c5412b84 /src/client/mac
parentIssue 202: reviewed by Waylonis (diff)
downloadbreakpad-d792274003fb0e7145161a290eff6d090a934bce.tar.xz
Issue203 : reviewed by Waylonis
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@206 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/mac')
-rw-r--r--src/client/mac/handler/exception_handler.cc31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/client/mac/handler/exception_handler.cc b/src/client/mac/handler/exception_handler.cc
index 72e3c811..0093724c 100644
--- a/src/client/mac/handler/exception_handler.cc
+++ b/src/client/mac/handler/exception_handler.cc
@@ -375,10 +375,6 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
sizeof(receive), self->handler_port_,
MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
-#if USE_PROTECTED_ALLOCATIONS
- if(gBreakpadAllocator)
- gBreakpadAllocator->Unprotect();
-#endif
if (result == KERN_SUCCESS) {
// Uninstall our handler so that we don't get in a loop if the process of
@@ -393,23 +389,32 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
// to avoid misleading stacks. If appropriate they will be resumed
// afterwards.
if (!receive.exception) {
- self->UninstallHandler(false);
-
if (self->is_in_teardown_)
return NULL;
self->SuspendThreads();
+#if USE_PROTECTED_ALLOCATIONS
+ if(gBreakpadAllocator)
+ gBreakpadAllocator->Unprotect();
+#endif
+
// Write out the dump and save the result for later retrieval
self->last_minidump_write_result_ =
self->WriteMinidumpWithException(0, 0, 0);
+ self->UninstallHandler(false);
+
+#if USE_PROTECTED_ALLOCATIONS
+ if(gBreakpadAllocator)
+ gBreakpadAllocator->Protect();
+#endif
+
self->ResumeThreads();
if (self->use_minidump_write_mutex_)
pthread_mutex_unlock(&self->minidump_write_mutex_);
} else {
- self->UninstallHandler(true);
// When forking a child process with the exception handler installed,
// if the child crashes, it will send the exception back to the parent
@@ -419,10 +424,22 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
if (receive.task.name == mach_task_self()) {
self->SuspendThreads();
+#if USE_PROTECTED_ALLOCATIONS
+ if(gBreakpadAllocator)
+ gBreakpadAllocator->Unprotect();
+#endif
+
// Generate the minidump with the exception data.
self->WriteMinidumpWithException(receive.exception, receive.code[0],
receive.thread.name);
+ self->UninstallHandler(true);
+
+#if USE_PROTECTED_ALLOCATIONS
+ if(gBreakpadAllocator)
+ gBreakpadAllocator->Protect();
+#endif
+
// Pass along the exception to the server, which will setup the
// message and call catch_exception_raise() and put the KERN_SUCCESS
// into the reply.