Add uncaught exception handler for native objc exceptions

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27168 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-11-28 15:38:48 +00:00
parent 908370d2fd
commit 1459f45289
7 changed files with 7316 additions and 7395 deletions

View file

@ -724,17 +724,31 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
_terminate();
}
static void
callUncaughtHandler(id value)
{
if (_NSUncaughtExceptionHandler != NULL)
{
(*_NSUncaughtExceptionHandler)(value);
}
_NSFoundationUncaughtExceptionHandler(value);
}
@implementation NSException
#if defined(STACKSYMBOLS)
+ (void) initialize
{
#if defined(STACKSYMBOLS)
if (modLock == nil)
{
modLock = [NSRecursiveLock new];
}
}
#endif /* STACKSYMBOLS */
#if defined(_NATIVE_OBJC_EXCEPTIONS) && defined(HAVE_UNEXPECTED)
objc_set_unexpected(callUncaughtHandler);
#endif
return;
}
+ (NSException*) exceptionWithName: (NSString*)name
reason: (NSString*)reason
@ -850,10 +864,7 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
/*
* Call the uncaught exception handler (if there is one).
*/
if (_NSUncaughtExceptionHandler != NULL)
{
(*_NSUncaughtExceptionHandler)(self);
}
callUncaughtHandler(self);
/*
* The uncaught exception handler which is set has not