Initializes contexts on ios x64 builds

In a later CL, in some cases these structs were not zero-initialized
which caused some iOS tests to fail.

We now zero-initialize these structs which should be harmless now,
and useful later.

Bug: 1250098
Change-Id: I933e80e56714a1d8988deae3aa56ec36ed98ef03
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3538665
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
This commit is contained in:
Alex Gough 2022-04-18 11:25:38 -07:00 committed by Crashpad LUCI CQ
parent 68aba08c48
commit 36c88b15b7
3 changed files with 13 additions and 3 deletions

View File

@ -294,7 +294,7 @@ static __attribute__((noinline)) id HANDLE_UNCAUGHT_NSEXCEPTION(
SetNSExceptionAnnotations(exception, name, reason);
LOG(WARNING) << "Handling Objective-C exception name: " << name
<< " reason: " << reason << " with sinkhole: " << sinkhole;
NativeCPUContext cpu_context;
NativeCPUContext cpu_context{};
CaptureContext(&cpu_context);
ExceptionPreprocessorState* preprocessor_state =

View File

@ -66,6 +66,13 @@ using Key = IntermediateDumpKey;
ExceptionSnapshotIOSIntermediateDump::ExceptionSnapshotIOSIntermediateDump()
: ExceptionSnapshot(),
#if defined(ARCH_CPU_X86_64)
context_x86_64_(),
#elif defined(ARCH_CPU_ARM64)
context_arm64_(),
#else
#error Port to your CPU architecture
#endif
context_(),
codes_(),
thread_id_(0),
@ -379,11 +386,9 @@ void ExceptionSnapshotIOSIntermediateDump::
}
#if defined(ARCH_CPU_X86_64)
context_x86_64_ = {};
context_x86_64_.rip = frames[0]; // instruction pointer
context_x86_64_.rsp = frames[1];
#elif defined(ARCH_CPU_ARM64)
context_arm64_ = {};
context_arm64_.sp = 0;
context_arm64_.pc = frames[0];
context_arm64_.regs[30] = frames[1]; // link register

View File

@ -68,6 +68,11 @@ using Key = IntermediateDumpKey;
ThreadSnapshotIOSIntermediateDump::ThreadSnapshotIOSIntermediateDump()
: ThreadSnapshot(),
#if defined(ARCH_CPU_X86_64)
context_x86_64_(),
#elif defined(ARCH_CPU_ARM64)
context_arm64_(),
#endif
context_(),
stack_(),
thread_id_(0),