fix top stack frame sometimes being lost

This commit is contained in:
Glenn Maynard
2004-04-04 20:49:24 +00:00
parent 664799ed01
commit c48c1e1802
2 changed files with 6 additions and 1 deletions
@@ -383,6 +383,7 @@ typedef struct Frame
void GetExceptionBacktraceContext( BacktraceContext *ctx, const ExceptionInformation *exception )
{
ctx->PC = (void *) exception->machineState->PC.lo;
ctx->FramePtr = (void *) exception->registerImage->R1.lo;
}
@@ -398,11 +399,15 @@ void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx )
/* __builtin_frame_address is broken on OS X; it sometimes returns bogus results. */
register void *r1 __asm__ ("r1");
CurrentCtx.FramePtr = (void *) r1;
CurrentCtx.PC = NULL;
}
const Frame *frame = (Frame *) ctx->FramePtr;
unsigned i = 0;
if( ctx->PC && i < size-1 )
buf[i++] = ctx->PC;
while( frame && i < size-1 ) // -1 for NULL
{
if( frame->linkReg )