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) ) if( thread_get_state(thread, PPC_THREAD_STATE, thread_state_t(&state), &count) )
return false; return false;
ctx->FramePtr = (void *)state.r1; ctx->FramePtr = (const Frame *)state.r1;
ctx->PC = (void *)state.srr0; ctx->PC = (void *)state.srr0;
return true; return true;
#elif defined(__i386__) #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) #elif defined(BACKTRACE_METHOD_POWERPC_DARWIN)
typedef struct Frame struct Frame
{ {
Frame *stackPointer; Frame *stackPointer;
long conditionReg; long conditionReg;
void *linkReg; void *linkReg;
} *FramePtr; };
void GetSignalBacktraceContext( BacktraceContext *ctx, const ucontext_t *uc ) void GetSignalBacktraceContext( BacktraceContext *ctx, const ucontext_t *uc )
{ {
ctx->PC = (void *) uc->uc_mcontext->ss.srr0; ctx->PC = (const void *) uc->uc_mcontext->ss.srr0;
ctx->FramePtr = (void *) uc->uc_mcontext->ss.r1; ctx->FramePtr = (const Frame *) uc->uc_mcontext->ss.r1;
} }
void InitializeBacktrace() { } 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. */ /* __builtin_frame_address is broken on OS X; it sometimes returns bogus results. */
register void *r1 __asm__ ("r1"); register void *r1 __asm__ ("r1");
CurrentCtx.FramePtr = (void *) r1; CurrentCtx.FramePtr = (const Frame *) r1;
CurrentCtx.PC = NULL; CurrentCtx.PC = NULL;
} }
const Frame *frame = (Frame *) ctx->FramePtr; const Frame *frame = ctx->FramePtr;
unsigned i = 0; unsigned i = 0;
if( ctx->PC && i < size-1 ) 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. */ /* 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. */ /* This contains the information necessary to backtrace a thread. */
struct BacktraceContext struct BacktraceContext
{ {
@@ -15,7 +18,8 @@ struct BacktraceContext
#endif #endif
#if defined(CPU_PPC) #if defined(CPU_PPC)
void *FramePtr, *PC; const Frame *FramePtr;
const void *PC;
#endif #endif
}; };