Skip navigation.
 
mlRe: Crashing on all relevant exceptions
FROM : Aaron Jacobs
DATE : Tue Aug 08 05:56:26 2006

This will print a bunch of memory locations in hexadecimal and then 
continue the program, which is not exactly ideal and is not even 
close to what my request for help continues to be.

If you read the thread you will see that lot of that code is 
unnecessary as the same can be accomplished by simply overriding -run 
in NSApplication.  Moreover, your RTFM quip is also unnecessary, as I 
mentioned basically the exact same solution of printing a stack trace 
(human-readable, no less) on the list an hour ago.

Thanks for the help, but next time please read my request more 
closely if you're going to be hostile about it.


> #include <RTFM>
> #import <Cocoa/Cocoa.h>
> #import <ExceptionHandling/NSExceptionHandler.h>
>
> static void MyUncaughtExceptionHandler(NSException *exception)
> {
>    NSLog(@"*** Uncaught exception: %@ %@ [%@]\n", [exception 
> name], [exception reason],
>        [[exception userInfo] objectForKey:NSStackTraceKey]);
> }
>
> int main(int argc, char *argv[])
> {
>    NSSetUncaughtExceptionHandler(MyUncaughtExceptionHandler);
>     
>    [[NSExceptionHandler defaultExceptionHandler] 
> setExceptionHandlingMask:
>        NSHandleUncaughtExceptionMask |
>        NSHandleUncaughtSystemExceptionMask |
>        NSHandleUncaughtRuntimeErrorMask |
>        NSHandleTopLevelExceptionMask |
>        NSHandleOtherExceptionMask];
>     
>    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>    NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
>    Class appClass = NSClassFromString([infoDict 
> objectForKey:@"NSPrincipalClass"]);
>    [NSBundle loadNibNamed:[infoDict objectForKey:@"NSMainNibFile"] 
> owner:[appClass sharedApplication]];
>    [NSApp finishLaunching];
>    [pool release];
>     
>     do {
>        @try {
>            [NSApp run];
>        }
>        @catch (NSException *exception) {
>            MyUncaughtExceptionHandler(exception);
>        }
>    } while ([NSApp isRunning]);
>     
>    return 0;
> }

Related mailsAuthorDate
mlCrashing on all relevant exceptions Aaron Jacobs Aug 7, 00:31
mlRe: Crashing on all relevant exceptions Nick Zitzmann Aug 7, 08:23
mlRe: Crashing on all relevant exceptions Aaron Jacobs Aug 7, 08:30
mlRe: Crashing on all relevant exceptions Chris Suter Aug 7, 08:34
mlRe: Crashing on all relevant exceptions Nick Zitzmann Aug 7, 17:47
mlRe: Crashing on all relevant exceptions Matt Neuburg Aug 7, 17:48
mlRe: Crashing on all relevant exceptions Aaron Jacobs Aug 7, 22:48
mlRe: Crashing on all relevant exceptions Aaron Jacobs Aug 7, 23:59
mlRe: Crashing on all relevant exceptions Shaun Wexler Aug 8, 02:28
mlRe: Crashing on all relevant exceptions Nick Zitzmann Aug 8, 03:38
mlRe: Crashing on all relevant exceptions Aaron Jacobs Aug 8, 04:34
mlRe: Crashing on all relevant exceptions Aaron Jacobs Aug 8, 04:53
mlRe: Crashing on all relevant exceptions Shaun Wexler Aug 8, 05:06
mlRe: Crashing on all relevant exceptions Aaron Jacobs Aug 8, 05:17
mlRe: Crashing on all relevant exceptions Shaun Wexler Aug 8, 05:19
mlRe: Crashing on all relevant exceptions Shaun Wexler Aug 8, 05:46
mlRe: Crashing on all relevant exceptions Aaron Jacobs Aug 8, 05:56
mlRe: Crashing on all relevant exceptions Shaun Wexler Aug 8, 23:12
mlRe: Crashing on all relevant exceptions Aaron Jacobs Aug 9, 00:35