diff --git a/src/client/mac/handler/minidump_generator.cc b/src/client/mac/handler/minidump_generator.cc index 9424c565..e91a3952 100644 --- a/src/client/mac/handler/minidump_generator.cc +++ b/src/client/mac/handler/minidump_generator.cc @@ -323,11 +323,7 @@ bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state, MDMemoryDescriptor *stack_location) { breakpad_thread_state_t *machine_state = reinterpret_cast(state); -#if TARGET_CPU_PPC - mach_vm_address_t start_addr = machine_state->r1; -#else - mach_vm_address_t start_addr = machine_state->__r1; -#endif + mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, r1); return WriteStackFromStartAddress(start_addr, stack_location); } @@ -336,11 +332,7 @@ MinidumpGenerator::CurrentPCForStack(breakpad_thread_state_data_t state) { breakpad_thread_state_t *machine_state = reinterpret_cast(state); -#if TARGET_CPU_PPC - return machine_state->srr0; -#else - return machine_state->__srr0; -#endif + return REGISTER_FROM_THREADSTATE(machine_state, srr0); } bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state, @@ -356,13 +348,8 @@ bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state, MinidumpContext *context_ptr = context.get(); context_ptr->context_flags = MD_CONTEXT_PPC_BASE; -#if TARGET_CPU_PPC64 -#define AddReg(a) context_ptr->a = machine_state->__ ## a -#define AddGPR(a) context_ptr->gpr[a] = machine_state->__r ## a -#else -#define AddReg(a) context_ptr->a = machine_state->a -#define AddGPR(a) context_ptr->gpr[a] = machine_state->r ## a -#endif +#define AddReg(a) context_ptr->a = REGISTER_FROM_THREADSTATE(machine_state, a) +#define AddGPR(a) context_ptr->gpr[a] = REGISTER_FROM_THREADSTATE(machine_state, r ## a) AddReg(srr0); AddReg(cr); diff --git a/src/client/mac/handler/minidump_generator.h b/src/client/mac/handler/minidump_generator.h index 8b4f327e..b065fba9 100644 --- a/src/client/mac/handler/minidump_generator.h +++ b/src/client/mac/handler/minidump_generator.h @@ -68,7 +68,7 @@ typedef MDRawContextPPC MinidumpContext; // Use the REGISTER_FROM_THREADSTATE to access a register name from the // breakpad_thread_state_t structure. -#if __DARWIN_UNIX03 || !TARGET_CPU_X86 || TARGET_CPU_X86_64 +#if __DARWIN_UNIX03 || TARGET_CPU_X86_64 || TARGET_CPU_PPC64 // In The 10.5 SDK Headers Apple prepended __ to the variable names in the // i386_thread_state_t structure. There's no good way to tell what version of // the SDK we're compiling against so we just toggle on the same preprocessor