@@ -23,10 +23,11 @@ #include #include #import "OFObject.h" +#import "OFArray.h" #import "OFTimer.h" #import "OFRunLoop.h" #import "OFThread.h" #import "OFAllocFailedException.h" @@ -104,12 +105,22 @@ #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) static void uncaught_exception_handler(id exception) { + OFArray *backtrace = nil; + fprintf(stderr, "\nRuntime error: Unhandled exception:\n%s\n", [[exception description] UTF8String]); + + if ([exception respondsToSelector: @selector(backtrace)]) + backtrace = [exception backtrace]; + + if (backtrace != nil) + fprintf(stderr, "\nBacktrace:\n %s\n\n", + [[backtrace componentsJoinedByString: @"\n "] UTF8String]); + abort(); } #endif static void