diff options
author | Joshua Peraza <jperaza@chromium.org> | 2020-01-03 09:43:46 -0800 |
---|---|---|
committer | Joshua Peraza <jperaza@chromium.org> | 2020-01-03 17:56:11 +0000 |
commit | e5ef907c2e9ce48f623775a7082f98baf341fa17 (patch) | |
tree | 209d1a59a41261627deab2092430f22cdb0f83c4 /src/client/mac | |
parent | Add dwarf5 compilation-unit header handling. (diff) | |
download | breakpad-e5ef907c2e9ce48f623775a7082f98baf341fa17.tar.xz |
ios: build for arm64e
When __DARWIN_OPAQUE_ARM_THREAD_STATE64 is set (by default when building
for arm64e), fp, lr, sp, pc, and flags (but not x or cpsr) in thread
state are prepended with "__opaque" and intended to be accessed via
supplied getters which may also authenticate pointers. We don't want to
authenticate those pointers (since we expect they may be invalid and
want to recover those invalid values) so access them directly.
Bug: b/140375065
Change-Id: Ibe6c1dbfb5d68a9d350614445fa06d48873f8549
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1986868
Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/client/mac')
-rw-r--r-- | src/client/mac/handler/minidump_generator.cc | 4 | ||||
-rw-r--r-- | src/client/mac/handler/minidump_generator.h | 19 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/client/mac/handler/minidump_generator.cc b/src/client/mac/handler/minidump_generator.cc index 8c796243..50df9002 100644 --- a/src/client/mac/handler/minidump_generator.cc +++ b/src/client/mac/handler/minidump_generator.cc @@ -556,8 +556,8 @@ MinidumpGenerator::WriteContextARM64(breakpad_thread_state_data_t state, MDRawContextARM64_Old *context_ptr = context.get(); context_ptr->context_flags = MD_CONTEXT_ARM64_FULL_OLD; -#define AddGPR(a) context_ptr->iregs[a] = \ - REGISTER_FROM_THREADSTATE(machine_state, x[a]) +#define AddGPR(a) \ + context_ptr->iregs[a] = ARRAY_REGISTER_FROM_THREADSTATE(machine_state, x, a) context_ptr->iregs[29] = REGISTER_FROM_THREADSTATE(machine_state, fp); context_ptr->iregs[30] = REGISTER_FROM_THREADSTATE(machine_state, lr); diff --git a/src/client/mac/handler/minidump_generator.h b/src/client/mac/handler/minidump_generator.h index d943f56a..f3aa9bd3 100644 --- a/src/client/mac/handler/minidump_generator.h +++ b/src/client/mac/handler/minidump_generator.h @@ -63,14 +63,31 @@ using std::string; // Use the REGISTER_FROM_THREADSTATE to access a register name from the // breakpad_thread_state_t structure. -#if __DARWIN_UNIX03 || TARGET_CPU_X86_64 || TARGET_CPU_PPC64 || TARGET_CPU_ARM +#if __DARWIN_OPAQUE_ARM_THREAD_STATE64 +#define ARRAY_REGISTER_FROM_THREADSTATE(a, b, i) ((a)->__##b[i]) +#define GET_REGISTER_FROM_THREADSTATE_fp(a) \ + (reinterpret_cast<uintptr_t>((a)->__opaque_fp)) +#define GET_REGISTER_FROM_THREADSTATE_lr(a) \ + (reinterpret_cast<uintptr_t>((a)->__opaque_lr)) +#define GET_REGISTER_FROM_THREADSTATE_sp(a) \ + (reinterpret_cast<uintptr_t>((a)->__opaque_sp)) +#define GET_REGISTER_FROM_THREADSTATE_pc(a) \ + (reinterpret_cast<uintptr_t>((a)->__opaque_pc)) +#define GET_REGISTER_FROM_THREADSTATE_cpsr(a) ((a)->__cpsr) +#define GET_REGISTER_FROM_THREADSTATE_flags(a) ((a)->__opaque_flags) +#define REGISTER_FROM_THREADSTATE(a, b) (GET_REGISTER_FROM_THREADSTATE_##b(a)) +#elif __DARWIN_UNIX03 || TARGET_CPU_X86_64 || TARGET_CPU_PPC64 || TARGET_CPU_ARM // 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 // symbol Apple's headers use. #define REGISTER_FROM_THREADSTATE(a, b) ((a)->__ ## b) +#define ARRAY_REGISTER_FROM_THREADSTATE(a, b, i) \ + REGISTER_FROM_THREADSTATE(a, b[i]) #else #define REGISTER_FROM_THREADSTATE(a, b) (a->b) +#define ARRAY_REGISTER_FROM_THREADSTATE(a, b, i) \ + REGISTER_FROM_THREADSTATE(a, b[i]) #endif // Creates a minidump file of the current process. If there is exception data, |