diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-01 13:04:33 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-01 13:04:33 +0200 |
commit | bfc97728065cbbc7f6bbc281b654a2d1e079b48d (patch) | |
tree | 152e4b2334b12441ba167231f98e177d9d4b9869 /xpcom | |
parent | a2786c051173286c9d7ccee2c3c6a19c15966322 (diff) | |
download | UXP-bfc97728065cbbc7f6bbc281b654a2d1e079b48d.tar UXP-bfc97728065cbbc7f6bbc281b654a2d1e079b48d.tar.gz UXP-bfc97728065cbbc7f6bbc281b654a2d1e079b48d.tar.lz UXP-bfc97728065cbbc7f6bbc281b654a2d1e079b48d.tar.xz UXP-bfc97728065cbbc7f6bbc281b654a2d1e079b48d.zip |
Unhook CR exception handler.
Tag #20
Diffstat (limited to 'xpcom')
-rw-r--r-- | xpcom/base/nsObjCExceptions.h | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/xpcom/base/nsObjCExceptions.h b/xpcom/base/nsObjCExceptions.h index b3ed532ec..e542a22f8 100644 --- a/xpcom/base/nsObjCExceptions.h +++ b/xpcom/base/nsObjCExceptions.h @@ -13,10 +13,6 @@ #import <Foundation/Foundation.h> -#ifdef DEBUG -#import <ExceptionHandling/NSExceptionHandler.h> -#endif - #include <unistd.h> #include <signal.h> #include "nsError.h" @@ -40,80 +36,6 @@ nsObjCExceptionLog(NSException* aException) { NSLog(@"Mozilla has caught an Obj-C exception [%@: %@]", [aException name], [aException reason]); - -#ifdef DEBUG - @try { - // Try to get stack information out of the exception. 10.5 returns the stack - // info with the callStackReturnAddresses selector. - NSArray* stackTrace = nil; - if ([aException respondsToSelector:@selector(callStackReturnAddresses)]) { - NSArray* addresses = (NSArray*) - [aException performSelector:@selector(callStackReturnAddresses)]; - if ([addresses count]) { - stackTrace = addresses; - } - } - - // 10.4 doesn't respond to callStackReturnAddresses so we'll try to pull the - // stack info out of the userInfo. It might not be there, sadly :( - if (!stackTrace) { - stackTrace = [[aException userInfo] objectForKey:NSStackTraceKey]; - } - - if (stackTrace) { - // The command line should look like this: - // /usr/bin/atos -p <pid> -printHeader <stack frame addresses> - NSMutableArray* args = - [NSMutableArray arrayWithCapacity:[stackTrace count] + 3]; - - [args addObject:@"-p"]; - int pid = [[NSProcessInfo processInfo] processIdentifier]; - [args addObject:[NSString stringWithFormat:@"%d", pid]]; - - [args addObject:@"-printHeader"]; - - unsigned int stackCount = [stackTrace count]; - unsigned int stackIndex = 0; - for (; stackIndex < stackCount; stackIndex++) { - unsigned long address = - [[stackTrace objectAtIndex:stackIndex] unsignedLongValue]; - [args addObject:[NSString stringWithFormat:@"0x%lx", address]]; - } - - NSPipe* outPipe = [NSPipe pipe]; - - NSTask* task = [[NSTask alloc] init]; - [task setLaunchPath:@"/usr/bin/atos"]; - [task setArguments:args]; - [task setStandardOutput:outPipe]; - [task setStandardError:outPipe]; - - NSLog(@"Generating stack trace for Obj-C exception..."); - - // This will throw an exception if the atos tool cannot be found, and in - // that case we'll just hit our @catch block below. - [task launch]; - - [task waitUntilExit]; - [task release]; - - NSData* outData = - [[outPipe fileHandleForReading] readDataToEndOfFile]; - NSString* outString = - [[NSString alloc] initWithData:outData encoding:NSUTF8StringEncoding]; - - NSLog(@"Stack trace:\n%@", outString); - - [outString release]; - } else { - NSLog(@"<No stack information available for Obj-C exception>"); - } - } - @catch (NSException* exn) { - NSLog(@"Failed to generate stack trace for Obj-C exception [%@: %@]", - [exn name], [exn reason]); - } -#endif } __attribute__((unused)) |