mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-28 00:54:19 +01:00
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
This commit is contained in:
parent
05d61dfd83
commit
bbc3789df1
@ -485,7 +485,7 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
|
|||||||
self->SuspendThreads();
|
self->SuspendThreads();
|
||||||
|
|
||||||
#if USE_PROTECTED_ALLOCATIONS
|
#if USE_PROTECTED_ALLOCATIONS
|
||||||
if(gBreakpadAllocator)
|
if (gBreakpadAllocator)
|
||||||
gBreakpadAllocator->Unprotect();
|
gBreakpadAllocator->Unprotect();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
|
|||||||
false, false);
|
false, false);
|
||||||
|
|
||||||
#if USE_PROTECTED_ALLOCATIONS
|
#if USE_PROTECTED_ALLOCATIONS
|
||||||
if(gBreakpadAllocator)
|
if (gBreakpadAllocator)
|
||||||
gBreakpadAllocator->Protect();
|
gBreakpadAllocator->Protect();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -534,7 +534,7 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
|
|||||||
self->SuspendThreads();
|
self->SuspendThreads();
|
||||||
|
|
||||||
#if USE_PROTECTED_ALLOCATIONS
|
#if USE_PROTECTED_ALLOCATIONS
|
||||||
if(gBreakpadAllocator)
|
if (gBreakpadAllocator)
|
||||||
gBreakpadAllocator->Unprotect();
|
gBreakpadAllocator->Unprotect();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -551,14 +551,14 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
|
|||||||
// This may have become protected again within
|
// This may have become protected again within
|
||||||
// WriteMinidumpWithException, but it needs to be unprotected for
|
// WriteMinidumpWithException, but it needs to be unprotected for
|
||||||
// UninstallHandler.
|
// UninstallHandler.
|
||||||
if(gBreakpadAllocator)
|
if (gBreakpadAllocator)
|
||||||
gBreakpadAllocator->Unprotect();
|
gBreakpadAllocator->Unprotect();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
self->UninstallHandler(true);
|
self->UninstallHandler(true);
|
||||||
|
|
||||||
#if USE_PROTECTED_ALLOCATIONS
|
#if USE_PROTECTED_ALLOCATIONS
|
||||||
if(gBreakpadAllocator)
|
if (gBreakpadAllocator)
|
||||||
gBreakpadAllocator->Protect();
|
gBreakpadAllocator->Protect();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -582,6 +582,10 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
|
void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
|
||||||
|
#if USE_PROTECTED_ALLOCATIONS
|
||||||
|
if (gBreakpadAllocator)
|
||||||
|
gBreakpadAllocator->Unprotect();
|
||||||
|
#endif
|
||||||
gProtectedData.handler->WriteMinidumpWithException(
|
gProtectedData.handler->WriteMinidumpWithException(
|
||||||
EXC_SOFTWARE,
|
EXC_SOFTWARE,
|
||||||
MD_EXCEPTION_CODE_MAC_ABORT,
|
MD_EXCEPTION_CODE_MAC_ABORT,
|
||||||
@ -589,6 +593,10 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
|
|||||||
mach_thread_self(),
|
mach_thread_self(),
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
|
#if USE_PROTECTED_ALLOCATIONS
|
||||||
|
if (gBreakpadAllocator)
|
||||||
|
gBreakpadAllocator->Protect();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExceptionHandler::InstallHandler() {
|
bool ExceptionHandler::InstallHandler() {
|
||||||
|
Loading…
Reference in New Issue
Block a user