Use Frame*.

This commit is contained in:
Steve Checkoway
2006-03-29 11:21:44 +00:00
parent 788ad134f1
commit 61363eff0b
3 changed files with 12 additions and 8 deletions
@@ -35,7 +35,7 @@ bool GetThreadBacktraceContext( uint64_t iID, BacktraceContext *ctx )
if( thread_get_state(thread, PPC_THREAD_STATE, thread_state_t(&state), &count) )
return false;
ctx->FramePtr = (void *)state.r1;
ctx->FramePtr = (const Frame *)state.r1;
ctx->PC = (void *)state.srr0;
return true;
#elif defined(__i386__)
+6 -6
View File
@@ -421,17 +421,17 @@ void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx )
}
#elif defined(BACKTRACE_METHOD_POWERPC_DARWIN)
typedef struct Frame
struct Frame
{
Frame *stackPointer;
long conditionReg;
void *linkReg;
} *FramePtr;
};
void GetSignalBacktraceContext( BacktraceContext *ctx, const ucontext_t *uc )
{
ctx->PC = (void *) uc->uc_mcontext->ss.srr0;
ctx->FramePtr = (void *) uc->uc_mcontext->ss.r1;
ctx->PC = (const void *) uc->uc_mcontext->ss.srr0;
ctx->FramePtr = (const Frame *) uc->uc_mcontext->ss.r1;
}
void InitializeBacktrace() { }
@@ -445,11 +445,11 @@ 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.FramePtr = (const Frame *) r1;
CurrentCtx.PC = NULL;
}
const Frame *frame = (Frame *) ctx->FramePtr;
const Frame *frame = ctx->FramePtr;
unsigned i = 0;
if( ctx->PC && i < size-1 )
+5 -1
View File
@@ -3,6 +3,9 @@
/* This API works like backtrace_pointers(), to retrieve a stack trace. */
#if defined(CPU_PPC)
struct Frame;
#endif
/* This contains the information necessary to backtrace a thread. */
struct BacktraceContext
{
@@ -15,7 +18,8 @@ struct BacktraceContext
#endif
#if defined(CPU_PPC)
void *FramePtr, *PC;
const Frame *FramePtr;
const void *PC;
#endif
};