Attempt prep work for 64 bit just in case.

If SDL2 fails, someone (not me) will have to try to
keep these updated.
This commit is contained in:
Jason Felds
2014-02-12 19:40:27 -05:00
parent 0715c38475
commit 9bbefe2240
4 changed files with 22 additions and 22 deletions
+14 -10
View File
@@ -27,16 +27,7 @@ bool GetThreadBacktraceContext( uint64_t iID, BacktraceContext *ctx )
thread_act_t thread = thread_act_t( iID );
#if defined(__ppc__)
ppc_thread_state_t state;
mach_msg_type_number_t count = PPC_THREAD_STATE_COUNT;
if( thread_get_state(thread, PPC_THREAD_STATE, thread_state_t(&state), &count) )
return false;
ctx->FramePtr = (const Frame *)state.__r1;
ctx->PC = (void *)state.__srr0;
return true;
#elif defined(__i386__)
#if defined(__i386__)
i386_thread_state_t state;
mach_msg_type_number_t count = i386_THREAD_STATE_COUNT;
@@ -46,6 +37,19 @@ bool GetThreadBacktraceContext( uint64_t iID, BacktraceContext *ctx )
ctx->bp = (void *)state.__ebp;
ctx->sp = (void *)state.__esp;
return true;
#elif defined(__x86_64__)
x86_thread_state64_t state;
mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT;
if (thread_get_state(thread, x86_THREAD_STATE64, thread_state_t(&state), &count))
{
return false;
}
ctx->ip = (void *)state.__rip;
ctx->bp = (void *)state.__rbp;
ctx->sp = (void *)state.__rsp;
return true;
#else
return false;
#endif