mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
More stacktrace tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25689 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a92018afe3
commit
bd4c02376c
2 changed files with 30 additions and 14 deletions
|
@ -1110,7 +1110,8 @@ NSMutableArray *
|
|||
GSPrivateStackAddresses(void)
|
||||
{
|
||||
unsigned n = NSCountFrames();
|
||||
NSMutableArray *stack;
|
||||
NSMutableArray *stack = [NSMutableArray arrayWithCapacity: n];
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
unsigned i;
|
||||
jmp_buf *env;
|
||||
void (*old)(int);
|
||||
|
@ -1127,7 +1128,6 @@ GSPrivateStackAddresses(void)
|
|||
n--;
|
||||
}
|
||||
|
||||
stack = [NSMutableArray arrayWithCapacity: n];
|
||||
env = jbuf();
|
||||
if (setjmp(*env) == 0)
|
||||
{
|
||||
|
@ -1192,7 +1192,7 @@ GSPrivateStackAddresses(void)
|
|||
memcpy(&old, val, sizeof(old));
|
||||
signal(SIGSEGV, old);
|
||||
}
|
||||
|
||||
RELEASE(pool);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
|
|
@ -700,6 +700,7 @@ static void _terminate()
|
|||
static void
|
||||
_NSFoundationUncaughtExceptionHandler (NSException *exception)
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n",
|
||||
GSPrivateArgZero(),
|
||||
[[exception name] lossyCString], [[exception reason] lossyCString]);
|
||||
|
@ -711,10 +712,10 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
#if defined(STACKSYMBOLS)
|
||||
o = AUTORELEASE([[GSStackTrace alloc] initWithAddresses: o]);
|
||||
#endif
|
||||
fprintf(stderr, "Stack\n%s\n", [o lossyCString]);
|
||||
fprintf(stderr, "Stack\n%s\n", [[o description] lossyCString]);
|
||||
}
|
||||
fflush(stderr); /* NEEDED UNDER MINGW */
|
||||
|
||||
RELEASE(pool);
|
||||
_terminate();
|
||||
}
|
||||
|
||||
|
@ -950,6 +951,9 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
|
||||
- (NSString*) description
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
NSString *result;
|
||||
|
||||
if (_reserved != 0)
|
||||
{
|
||||
if (_e_stack != nil
|
||||
|
@ -965,20 +969,32 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
#endif
|
||||
if (_e_info != nil)
|
||||
{
|
||||
return [NSString stringWithFormat:
|
||||
result = [NSString stringWithFormat:
|
||||
@"%@ NAME:%@ REASON:%@ INFO:%@ STACK:%@",
|
||||
[super description], _e_name, _e_reason, _e_info, o];
|
||||
}
|
||||
return [NSString stringWithFormat:
|
||||
@"%@ NAME:%@ REASON:%@ STACK:%@",
|
||||
[super description], _e_name, _e_reason, o];
|
||||
else
|
||||
{
|
||||
result = [NSString stringWithFormat:
|
||||
@"%@ NAME:%@ REASON:%@ STACK:%@",
|
||||
[super description], _e_name, _e_reason, o];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = [NSString stringWithFormat:
|
||||
@"%@ NAME:%@ REASON:%@ INFO:%@",
|
||||
[super description], _e_name, _e_reason, _e_info];
|
||||
}
|
||||
return [NSString stringWithFormat:
|
||||
@"%@ NAME:%@ REASON:%@ INFO:%@",
|
||||
[super description], _e_name, _e_reason, _e_info];
|
||||
}
|
||||
return [NSString stringWithFormat: @"%@ NAME:%@ REASON:%@",
|
||||
[super description], _e_name, _e_reason];
|
||||
else
|
||||
{
|
||||
result = [NSString stringWithFormat: @"%@ NAME:%@ REASON:%@",
|
||||
[super description], _e_name, _e_reason];
|
||||
}
|
||||
RETAIN(result);
|
||||
DESTROY(pool);
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue