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>
This commit is contained in:
parent
dbd454dbe4
commit
e5ef907c2e
2 changed files with 20 additions and 3 deletions
|
@ -556,8 +556,8 @@ MinidumpGenerator::WriteContextARM64(breakpad_thread_state_data_t state,
|
||||||
MDRawContextARM64_Old *context_ptr = context.get();
|
MDRawContextARM64_Old *context_ptr = context.get();
|
||||||
context_ptr->context_flags = MD_CONTEXT_ARM64_FULL_OLD;
|
context_ptr->context_flags = MD_CONTEXT_ARM64_FULL_OLD;
|
||||||
|
|
||||||
#define AddGPR(a) context_ptr->iregs[a] = \
|
#define AddGPR(a) \
|
||||||
REGISTER_FROM_THREADSTATE(machine_state, x[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[29] = REGISTER_FROM_THREADSTATE(machine_state, fp);
|
||||||
context_ptr->iregs[30] = REGISTER_FROM_THREADSTATE(machine_state, lr);
|
context_ptr->iregs[30] = REGISTER_FROM_THREADSTATE(machine_state, lr);
|
||||||
|
|
|
@ -63,14 +63,31 @@ using std::string;
|
||||||
|
|
||||||
// Use the REGISTER_FROM_THREADSTATE to access a register name from the
|
// Use the REGISTER_FROM_THREADSTATE to access a register name from the
|
||||||
// breakpad_thread_state_t structure.
|
// 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
|
// 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
|
// 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
|
// the SDK we're compiling against so we just toggle on the same preprocessor
|
||||||
// symbol Apple's headers use.
|
// symbol Apple's headers use.
|
||||||
#define REGISTER_FROM_THREADSTATE(a, b) ((a)->__ ## b)
|
#define REGISTER_FROM_THREADSTATE(a, b) ((a)->__ ## b)
|
||||||
|
#define ARRAY_REGISTER_FROM_THREADSTATE(a, b, i) \
|
||||||
|
REGISTER_FROM_THREADSTATE(a, b[i])
|
||||||
#else
|
#else
|
||||||
#define REGISTER_FROM_THREADSTATE(a, b) (a->b)
|
#define REGISTER_FROM_THREADSTATE(a, b) (a->b)
|
||||||
|
#define ARRAY_REGISTER_FROM_THREADSTATE(a, b, i) \
|
||||||
|
REGISTER_FROM_THREADSTATE(a, b[i])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Creates a minidump file of the current process. If there is exception data,
|
// Creates a minidump file of the current process. If there is exception data,
|
||||||
|
|
Loading…
Reference in a new issue