mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-09-14 19:37:15 +00:00
Allow the Breakpad Mac framework to be built without -fexceptions.
Review URL: http://breakpad.appspot.com/34003 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@417 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
cb33b20f75
commit
a3043159f3
|
@ -747,65 +747,59 @@ BreakpadRef BreakpadCreate(NSDictionary *parameters) {
|
||||||
|
|
||||||
// Create a mutex for use in accessing the SimpleStringDictionary
|
// Create a mutex for use in accessing the SimpleStringDictionary
|
||||||
int mutexResult = pthread_mutex_init(&gDictionaryMutex, NULL);
|
int mutexResult = pthread_mutex_init(&gDictionaryMutex, NULL);
|
||||||
if (mutexResult != 0) {
|
if (mutexResult == 0) {
|
||||||
throw mutexResult; // caught down below
|
|
||||||
}
|
|
||||||
|
|
||||||
// With the current compiler, gBreakpadAllocator is allocating 1444 bytes.
|
// With the current compiler, gBreakpadAllocator is allocating 1444 bytes.
|
||||||
// Let's round up to the nearest page size.
|
// Let's round up to the nearest page size.
|
||||||
//
|
//
|
||||||
int breakpad_pool_size = 4096;
|
int breakpad_pool_size = 4096;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sizeof(Breakpad)
|
sizeof(Breakpad)
|
||||||
+ sizeof(google_breakpad::ExceptionHandler)
|
+ sizeof(google_breakpad::ExceptionHandler)
|
||||||
+ sizeof( STUFF ALLOCATED INSIDE ExceptionHandler )
|
+ sizeof( STUFF ALLOCATED INSIDE ExceptionHandler )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gBreakpadAllocator =
|
gBreakpadAllocator =
|
||||||
new (gMasterAllocator->Allocate(sizeof(ProtectedMemoryAllocator)))
|
new (gMasterAllocator->Allocate(sizeof(ProtectedMemoryAllocator)))
|
||||||
ProtectedMemoryAllocator(breakpad_pool_size);
|
ProtectedMemoryAllocator(breakpad_pool_size);
|
||||||
|
|
||||||
// Stack-based autorelease pool for Breakpad::Create() obj-c code.
|
// Stack-based autorelease pool for Breakpad::Create() obj-c code.
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
Breakpad *breakpad = Breakpad::Create(parameters);
|
Breakpad *breakpad = Breakpad::Create(parameters);
|
||||||
|
|
||||||
|
if (breakpad) {
|
||||||
|
// Make read-only to protect against memory smashers
|
||||||
|
gMasterAllocator->Protect();
|
||||||
|
gKeyValueAllocator->Protect();
|
||||||
|
gBreakpadAllocator->Protect();
|
||||||
|
// Can uncomment this line to figure out how much space was actually
|
||||||
|
// allocated using this allocator
|
||||||
|
// printf("gBreakpadAllocator allocated size = %d\n",
|
||||||
|
// gBreakpadAllocator->GetAllocatedSize() );
|
||||||
|
[pool release];
|
||||||
|
return (BreakpadRef)breakpad;
|
||||||
|
}
|
||||||
|
|
||||||
if (breakpad) {
|
|
||||||
// Make read-only to protect against memory smashers
|
|
||||||
gMasterAllocator->Protect();
|
|
||||||
gKeyValueAllocator->Protect();
|
|
||||||
gBreakpadAllocator->Protect();
|
|
||||||
} else {
|
|
||||||
[pool release];
|
[pool release];
|
||||||
#ifdef __EXCEPTIONS
|
|
||||||
throw(-1);
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can uncomment this line to figure out how much space was actually
|
|
||||||
// allocated using this allocator
|
|
||||||
// printf("gBreakpadAllocator allocated size = %d\n",
|
|
||||||
// gBreakpadAllocator->GetAllocatedSize() );
|
|
||||||
|
|
||||||
[pool release];
|
|
||||||
return (BreakpadRef)breakpad;
|
|
||||||
} catch(...) { // don't let exceptions leave this C API
|
} catch(...) { // don't let exceptions leave this C API
|
||||||
if (gKeyValueAllocator) {
|
fprintf(stderr, "BreakpadCreate() : error\n");
|
||||||
gKeyValueAllocator->~ProtectedMemoryAllocator();
|
|
||||||
gKeyValueAllocator = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gBreakpadAllocator) {
|
|
||||||
gBreakpadAllocator->~ProtectedMemoryAllocator();
|
|
||||||
gBreakpadAllocator = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete gMasterAllocator;
|
|
||||||
gMasterAllocator = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gKeyValueAllocator) {
|
||||||
|
gKeyValueAllocator->~ProtectedMemoryAllocator();
|
||||||
|
gKeyValueAllocator = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gBreakpadAllocator) {
|
||||||
|
gBreakpadAllocator->~ProtectedMemoryAllocator();
|
||||||
|
gBreakpadAllocator = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete gMasterAllocator;
|
||||||
|
gMasterAllocator = NULL;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue