mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +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
4862e74963
commit
8f72ab36c0
2 changed files with 30 additions and 14 deletions
|
@ -1110,7 +1110,8 @@ NSMutableArray *
|
||||||
GSPrivateStackAddresses(void)
|
GSPrivateStackAddresses(void)
|
||||||
{
|
{
|
||||||
unsigned n = NSCountFrames();
|
unsigned n = NSCountFrames();
|
||||||
NSMutableArray *stack;
|
NSMutableArray *stack = [NSMutableArray arrayWithCapacity: n];
|
||||||
|
CREATE_AUTORELEASE_POOL(pool);
|
||||||
unsigned i;
|
unsigned i;
|
||||||
jmp_buf *env;
|
jmp_buf *env;
|
||||||
void (*old)(int);
|
void (*old)(int);
|
||||||
|
@ -1127,7 +1128,6 @@ GSPrivateStackAddresses(void)
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack = [NSMutableArray arrayWithCapacity: n];
|
|
||||||
env = jbuf();
|
env = jbuf();
|
||||||
if (setjmp(*env) == 0)
|
if (setjmp(*env) == 0)
|
||||||
{
|
{
|
||||||
|
@ -1192,7 +1192,7 @@ GSPrivateStackAddresses(void)
|
||||||
memcpy(&old, val, sizeof(old));
|
memcpy(&old, val, sizeof(old));
|
||||||
signal(SIGSEGV, old);
|
signal(SIGSEGV, old);
|
||||||
}
|
}
|
||||||
|
RELEASE(pool);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -700,6 +700,7 @@ static void _terminate()
|
||||||
static void
|
static void
|
||||||
_NSFoundationUncaughtExceptionHandler (NSException *exception)
|
_NSFoundationUncaughtExceptionHandler (NSException *exception)
|
||||||
{
|
{
|
||||||
|
CREATE_AUTORELEASE_POOL(pool);
|
||||||
fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n",
|
fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n",
|
||||||
GSPrivateArgZero(),
|
GSPrivateArgZero(),
|
||||||
[[exception name] lossyCString], [[exception reason] lossyCString]);
|
[[exception name] lossyCString], [[exception reason] lossyCString]);
|
||||||
|
@ -711,10 +712,10 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
||||||
#if defined(STACKSYMBOLS)
|
#if defined(STACKSYMBOLS)
|
||||||
o = AUTORELEASE([[GSStackTrace alloc] initWithAddresses: o]);
|
o = AUTORELEASE([[GSStackTrace alloc] initWithAddresses: o]);
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, "Stack\n%s\n", [o lossyCString]);
|
fprintf(stderr, "Stack\n%s\n", [[o description] lossyCString]);
|
||||||
}
|
}
|
||||||
fflush(stderr); /* NEEDED UNDER MINGW */
|
fflush(stderr); /* NEEDED UNDER MINGW */
|
||||||
|
RELEASE(pool);
|
||||||
_terminate();
|
_terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,6 +951,9 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
||||||
|
|
||||||
- (NSString*) description
|
- (NSString*) description
|
||||||
{
|
{
|
||||||
|
CREATE_AUTORELEASE_POOL(pool);
|
||||||
|
NSString *result;
|
||||||
|
|
||||||
if (_reserved != 0)
|
if (_reserved != 0)
|
||||||
{
|
{
|
||||||
if (_e_stack != nil
|
if (_e_stack != nil
|
||||||
|
@ -965,20 +969,32 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
||||||
#endif
|
#endif
|
||||||
if (_e_info != nil)
|
if (_e_info != nil)
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:
|
result = [NSString stringWithFormat:
|
||||||
@"%@ NAME:%@ REASON:%@ INFO:%@ STACK:%@",
|
@"%@ NAME:%@ REASON:%@ INFO:%@ STACK:%@",
|
||||||
[super description], _e_name, _e_reason, _e_info, o];
|
[super description], _e_name, _e_reason, _e_info, o];
|
||||||
}
|
}
|
||||||
return [NSString stringWithFormat:
|
else
|
||||||
@"%@ NAME:%@ REASON:%@ STACK:%@",
|
{
|
||||||
[super description], _e_name, _e_reason, o];
|
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:%@",
|
else
|
||||||
[super description], _e_name, _e_reason];
|
{
|
||||||
|
result = [NSString stringWithFormat: @"%@ NAME:%@ REASON:%@",
|
||||||
|
[super description], _e_name, _e_reason];
|
||||||
|
}
|
||||||
|
RETAIN(result);
|
||||||
|
DESTROY(pool);
|
||||||
|
return AUTORELEASE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue