aboutsummaryrefslogtreecommitdiff
path: root/src/client/mac
diff options
context:
space:
mode:
authormmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-10-15 22:42:54 +0000
committermmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-10-15 22:42:54 +0000
commita3043159f37d4d93297dfb5f3a26952d6c1437f1 (patch)
treed9b889be4a599675a8001425f1a83e9a54befa22 /src/client/mac
parentRaise minidump processing limits (diff)
downloadbreakpad-a3043159f37d4d93297dfb5f3a26952d6c1437f1.tar.xz
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
Diffstat (limited to 'src/client/mac')
-rw-r--r--src/client/mac/Framework/Breakpad.mm96
1 files changed, 45 insertions, 51 deletions
diff --git a/src/client/mac/Framework/Breakpad.mm b/src/client/mac/Framework/Breakpad.mm
index 2528d99f..23e5d9bf 100644
--- a/src/client/mac/Framework/Breakpad.mm
+++ b/src/client/mac/Framework/Breakpad.mm
@@ -747,65 +747,59 @@ BreakpadRef BreakpadCreate(NSDictionary *parameters) {
// Create a mutex for use in accessing the SimpleStringDictionary
int mutexResult = pthread_mutex_init(&gDictionaryMutex, NULL);
- if (mutexResult != 0) {
- throw mutexResult; // caught down below
- }
-
- // With the current compiler, gBreakpadAllocator is allocating 1444 bytes.
- // Let's round up to the nearest page size.
- //
- int breakpad_pool_size = 4096;
-
- /*
- sizeof(Breakpad)
- + sizeof(google_breakpad::ExceptionHandler)
- + sizeof( STUFF ALLOCATED INSIDE ExceptionHandler )
- */
-
- gBreakpadAllocator =
- new (gMasterAllocator->Allocate(sizeof(ProtectedMemoryAllocator)))
- ProtectedMemoryAllocator(breakpad_pool_size);
-
- // Stack-based autorelease pool for Breakpad::Create() obj-c code.
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- Breakpad *breakpad = Breakpad::Create(parameters);
+ if (mutexResult == 0) {
+
+ // With the current compiler, gBreakpadAllocator is allocating 1444 bytes.
+ // Let's round up to the nearest page size.
+ //
+ int breakpad_pool_size = 4096;
+
+ /*
+ sizeof(Breakpad)
+ + sizeof(google_breakpad::ExceptionHandler)
+ + sizeof( STUFF ALLOCATED INSIDE ExceptionHandler )
+ */
+
+ gBreakpadAllocator =
+ new (gMasterAllocator->Allocate(sizeof(ProtectedMemoryAllocator)))
+ ProtectedMemoryAllocator(breakpad_pool_size);
+
+ // Stack-based autorelease pool for Breakpad::Create() obj-c code.
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ 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];
-#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
- if (gKeyValueAllocator) {
- gKeyValueAllocator->~ProtectedMemoryAllocator();
- gKeyValueAllocator = NULL;
- }
+ fprintf(stderr, "BreakpadCreate() : error\n");
+ }
- if (gBreakpadAllocator) {
- gBreakpadAllocator->~ProtectedMemoryAllocator();
- gBreakpadAllocator = NULL;
- }
+ if (gKeyValueAllocator) {
+ gKeyValueAllocator->~ProtectedMemoryAllocator();
+ gKeyValueAllocator = NULL;
+ }
- delete gMasterAllocator;
- gMasterAllocator = NULL;
+ if (gBreakpadAllocator) {
+ gBreakpadAllocator->~ProtectedMemoryAllocator();
+ gBreakpadAllocator = NULL;
}
+ delete gMasterAllocator;
+ gMasterAllocator = NULL;
+
return NULL;
}