From d792274003fb0e7145161a290eff6d090a934bce Mon Sep 17 00:00:00 2001 From: ladderbreaker Date: Wed, 29 Aug 2007 21:28:46 +0000 Subject: Issue203 : reviewed by Waylonis git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@206 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/mac/handler/exception_handler.cc | 31 ++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'src/client/mac/handler') 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. -- cgit v1.2.1