mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2025-12-26 01:05:07 +01:00
Rename MDRawContextARM64 and its context flags
This makes way for the addition of a struct matching Microsoft's layout for ARM64. Change-Id: I115f25290863e7438852691d1ec3c9324a42f7a5 Reviewed-on: https://chromium-review.googlesource.com/1152158 Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
948ce04ed7
commit
627ef0cb9c
20 changed files with 71 additions and 71 deletions
|
|
@ -121,13 +121,13 @@ const MDRawContextARM* DumpContext::GetContextARM() const {
|
|||
return context_.arm;
|
||||
}
|
||||
|
||||
const MDRawContextARM64* DumpContext::GetContextARM64() const {
|
||||
if (GetContextCPU() != MD_CONTEXT_ARM64) {
|
||||
const MDRawContextARM64_Old* DumpContext::GetContextARM64() const {
|
||||
if (GetContextCPU() != MD_CONTEXT_ARM64_OLD) {
|
||||
BPLOG(ERROR) << "DumpContext cannot get arm64 context";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return context_.arm64;
|
||||
return context_.arm64_old;
|
||||
}
|
||||
|
||||
const MDRawContextMIPS* DumpContext::GetContextMIPS() const {
|
||||
|
|
@ -157,7 +157,7 @@ bool DumpContext::GetInstructionPointer(uint64_t* ip) const {
|
|||
case MD_CONTEXT_ARM:
|
||||
*ip = GetContextARM()->iregs[MD_CONTEXT_ARM_REG_PC];
|
||||
break;
|
||||
case MD_CONTEXT_ARM64:
|
||||
case MD_CONTEXT_ARM64_OLD:
|
||||
*ip = GetContextARM64()->iregs[MD_CONTEXT_ARM64_REG_PC];
|
||||
break;
|
||||
case MD_CONTEXT_PPC:
|
||||
|
|
@ -201,7 +201,7 @@ bool DumpContext::GetStackPointer(uint64_t* sp) const {
|
|||
case MD_CONTEXT_ARM:
|
||||
*sp = GetContextARM()->iregs[MD_CONTEXT_ARM_REG_SP];
|
||||
break;
|
||||
case MD_CONTEXT_ARM64:
|
||||
case MD_CONTEXT_ARM64_OLD:
|
||||
*sp = GetContextARM64()->iregs[MD_CONTEXT_ARM64_REG_SP];
|
||||
break;
|
||||
case MD_CONTEXT_PPC:
|
||||
|
|
@ -256,8 +256,8 @@ void DumpContext::SetContextARM(MDRawContextARM* arm) {
|
|||
context_.arm = arm;
|
||||
}
|
||||
|
||||
void DumpContext::SetContextARM64(MDRawContextARM64* arm64) {
|
||||
context_.arm64 = arm64;
|
||||
void DumpContext::SetContextARM64(MDRawContextARM64_Old* arm64) {
|
||||
context_.arm64_old = arm64;
|
||||
}
|
||||
|
||||
void DumpContext::SetContextMIPS(MDRawContextMIPS* ctx_mips) {
|
||||
|
|
@ -290,8 +290,8 @@ void DumpContext::FreeContext() {
|
|||
delete context_.arm;
|
||||
break;
|
||||
|
||||
case MD_CONTEXT_ARM64:
|
||||
delete context_.arm64;
|
||||
case MD_CONTEXT_ARM64_OLD:
|
||||
delete context_.arm64_old;
|
||||
break;
|
||||
|
||||
case MD_CONTEXT_MIPS:
|
||||
|
|
@ -581,8 +581,8 @@ void DumpContext::Print() {
|
|||
break;
|
||||
}
|
||||
|
||||
case MD_CONTEXT_ARM64: {
|
||||
const MDRawContextARM64* context_arm64 = GetContextARM64();
|
||||
case MD_CONTEXT_ARM64_OLD: {
|
||||
const MDRawContextARM64_Old* context_arm64 = GetContextARM64();
|
||||
printf("MDRawContextARM64\n");
|
||||
printf(" context_flags = 0x%" PRIx64 "\n",
|
||||
context_arm64->context_flags);
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ void MicrodumpContext::SetContextARM(MDRawContextARM* arm) {
|
|||
valid_ = true;
|
||||
}
|
||||
|
||||
void MicrodumpContext::SetContextARM64(MDRawContextARM64* arm64) {
|
||||
DumpContext::SetContextFlags(MD_CONTEXT_ARM64);
|
||||
void MicrodumpContext::SetContextARM64(MDRawContextARM64_Old* arm64) {
|
||||
DumpContext::SetContextFlags(MD_CONTEXT_ARM64_OLD);
|
||||
DumpContext::SetContextARM64(arm64);
|
||||
valid_ = true;
|
||||
}
|
||||
|
|
@ -311,13 +311,13 @@ Microdump::Microdump(const string& contents)
|
|||
memcpy(arm, &cpu_state_raw[0], cpu_state_raw.size());
|
||||
context_->SetContextARM(arm);
|
||||
} else if (strcmp(arch.c_str(), kArm64Architecture) == 0) {
|
||||
if (cpu_state_raw.size() != sizeof(MDRawContextARM64)) {
|
||||
if (cpu_state_raw.size() != sizeof(MDRawContextARM64_Old)) {
|
||||
std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size()
|
||||
<< " bytes instead of " << sizeof(MDRawContextARM64)
|
||||
<< " bytes instead of " << sizeof(MDRawContextARM64_Old)
|
||||
<< std::endl;
|
||||
continue;
|
||||
}
|
||||
MDRawContextARM64* arm = new MDRawContextARM64();
|
||||
MDRawContextARM64_Old* arm = new MDRawContextARM64_Old();
|
||||
memcpy(arm, &cpu_state_raw[0], cpu_state_raw.size());
|
||||
context_->SetContextARM64(arm);
|
||||
} else if (strcmp(arch.c_str(), kX86Architecture) == 0) {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ bool IsContextSizeUnique(uint32_t context_size) {
|
|||
num_matching_contexts++;
|
||||
if (context_size == sizeof(MDRawContextARM))
|
||||
num_matching_contexts++;
|
||||
if (context_size == sizeof(MDRawContextARM64))
|
||||
if (context_size == sizeof(MDRawContextARM64_Old))
|
||||
num_matching_contexts++;
|
||||
if (context_size == sizeof(MDRawContextMIPS))
|
||||
num_matching_contexts++;
|
||||
|
|
@ -471,8 +471,8 @@ bool MinidumpContext::Read(uint32_t expected_size) {
|
|||
<< "other raw context";
|
||||
return false;
|
||||
}
|
||||
if (!IsContextSizeUnique(sizeof(MDRawContextARM64))) {
|
||||
BPLOG(ERROR) << "sizeof(MDRawContextARM64) cannot match the size of any "
|
||||
if (!IsContextSizeUnique(sizeof(MDRawContextARM64_Old))) {
|
||||
BPLOG(ERROR) << "sizeof(MDRawContextARM64_Old) cannot match the size of any "
|
||||
<< "other raw context";
|
||||
return false;
|
||||
}
|
||||
|
|
@ -678,8 +678,8 @@ bool MinidumpContext::Read(uint32_t expected_size) {
|
|||
}
|
||||
|
||||
SetContextPPC64(context_ppc64.release());
|
||||
} else if (expected_size == sizeof(MDRawContextARM64)) {
|
||||
// |context_flags| of MDRawContextARM64 is 64 bits, but other MDRawContext
|
||||
} else if (expected_size == sizeof(MDRawContextARM64_Old)) {
|
||||
// |context_flags| of MDRawContextARM64_Old is 64 bits, but other MDRawContext
|
||||
// in the else case have 32 bits |context_flags|, so special case it here.
|
||||
uint64_t context_flags;
|
||||
|
||||
|
|
@ -692,7 +692,7 @@ bool MinidumpContext::Read(uint32_t expected_size) {
|
|||
if (minidump_->swap())
|
||||
Swap(&context_flags);
|
||||
|
||||
scoped_ptr<MDRawContextARM64> context_arm64(new MDRawContextARM64());
|
||||
scoped_ptr<MDRawContextARM64_Old> context_arm64(new MDRawContextARM64_Old());
|
||||
|
||||
uint32_t cpu_type = context_flags & MD_CONTEXT_CPU_MASK;
|
||||
if (cpu_type == 0) {
|
||||
|
|
@ -704,7 +704,7 @@ bool MinidumpContext::Read(uint32_t expected_size) {
|
|||
}
|
||||
}
|
||||
|
||||
if (cpu_type != MD_CONTEXT_ARM64) {
|
||||
if (cpu_type != MD_CONTEXT_ARM64_OLD) {
|
||||
// TODO: Fall through to switch below.
|
||||
// https://bugs.chromium.org/p/google-breakpad/issues/detail?id=550
|
||||
BPLOG(ERROR) << "MinidumpContext not actually arm64 context";
|
||||
|
|
@ -720,7 +720,7 @@ bool MinidumpContext::Read(uint32_t expected_size) {
|
|||
uint8_t* context_after_flags =
|
||||
reinterpret_cast<uint8_t*>(context_arm64.get()) + flags_size;
|
||||
if (!minidump_->ReadBytes(context_after_flags,
|
||||
sizeof(MDRawContextARM64) - flags_size)) {
|
||||
sizeof(MDRawContextARM64_Old) - flags_size)) {
|
||||
BPLOG(ERROR) << "MinidumpContext could not read arm64 context";
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1199,8 +1199,8 @@ bool MinidumpContext::CheckAgainstSystemInfo(uint32_t context_cpu_type) {
|
|||
return_value = true;
|
||||
break;
|
||||
|
||||
case MD_CONTEXT_ARM64:
|
||||
if (system_info_cpu_type == MD_CPU_ARCHITECTURE_ARM64)
|
||||
case MD_CONTEXT_ARM64_OLD:
|
||||
if (system_info_cpu_type == MD_CPU_ARCHITECTURE_ARM64_OLD)
|
||||
return_value = true;
|
||||
break;
|
||||
|
||||
|
|
@ -3487,7 +3487,7 @@ string MinidumpSystemInfo::GetCPU() {
|
|||
cpu = "arm";
|
||||
break;
|
||||
|
||||
case MD_CPU_ARCHITECTURE_ARM64:
|
||||
case MD_CPU_ARCHITECTURE_ARM64_OLD:
|
||||
cpu = "arm64";
|
||||
break;
|
||||
|
||||
|
|
@ -5086,8 +5086,8 @@ bool Minidump::GetContextCPUFlagsFromSystemInfo(uint32_t *context_cpu_flags) {
|
|||
case MD_CPU_ARCHITECTURE_ARM:
|
||||
*context_cpu_flags = MD_CONTEXT_ARM;
|
||||
break;
|
||||
case MD_CPU_ARCHITECTURE_ARM64:
|
||||
*context_cpu_flags = MD_CONTEXT_ARM64;
|
||||
case MD_CPU_ARCHITECTURE_ARM64_OLD:
|
||||
*context_cpu_flags = MD_CONTEXT_ARM64_OLD;
|
||||
break;
|
||||
case MD_CPU_ARCHITECTURE_IA64:
|
||||
*context_cpu_flags = MD_CONTEXT_IA64;
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ bool MinidumpProcessor::GetCPUInfo(Minidump *dump, SystemInfo *info) {
|
|||
break;
|
||||
}
|
||||
|
||||
case MD_CPU_ARCHITECTURE_ARM64: {
|
||||
case MD_CPU_ARCHITECTURE_ARM64_OLD: {
|
||||
info->cpu = "arm64";
|
||||
break;
|
||||
}
|
||||
|
|
@ -735,7 +735,7 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) {
|
|||
if (raw_system_info->processor_architecture ==
|
||||
MD_CPU_ARCHITECTURE_ARM ||
|
||||
raw_system_info->processor_architecture ==
|
||||
MD_CPU_ARCHITECTURE_ARM64) {
|
||||
MD_CPU_ARCHITECTURE_ARM64_OLD) {
|
||||
switch (exception_flags) {
|
||||
case MD_EXCEPTION_CODE_MAC_ARM_DA_ALIGN:
|
||||
reason.append("EXC_ARM_DA_ALIGN");
|
||||
|
|
@ -789,7 +789,7 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) {
|
|||
reason = "EXC_BAD_INSTRUCTION / ";
|
||||
switch (raw_system_info->processor_architecture) {
|
||||
case MD_CPU_ARCHITECTURE_ARM:
|
||||
case MD_CPU_ARCHITECTURE_ARM64: {
|
||||
case MD_CPU_ARCHITECTURE_ARM64_OLD: {
|
||||
switch (exception_flags) {
|
||||
case MD_EXCEPTION_CODE_MAC_ARM_UNDEFINED:
|
||||
reason.append("EXC_ARM_UNDEFINED");
|
||||
|
|
@ -972,7 +972,7 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) {
|
|||
reason = "EXC_BREAKPOINT / ";
|
||||
switch (raw_system_info->processor_architecture) {
|
||||
case MD_CPU_ARCHITECTURE_ARM:
|
||||
case MD_CPU_ARCHITECTURE_ARM64: {
|
||||
case MD_CPU_ARCHITECTURE_ARM64_OLD: {
|
||||
switch (exception_flags) {
|
||||
case MD_EXCEPTION_CODE_MAC_ARM_DA_ALIGN:
|
||||
reason.append("EXC_ARM_DA_ALIGN");
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ Stackwalker* Stackwalker::StackwalkerForCPU(
|
|||
break;
|
||||
}
|
||||
|
||||
case MD_CONTEXT_ARM64:
|
||||
case MD_CONTEXT_ARM64_OLD:
|
||||
cpu_stackwalker = new StackwalkerARM64(system_info,
|
||||
context->GetContextARM64(),
|
||||
memory, modules,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace google_breakpad {
|
|||
|
||||
|
||||
StackwalkerARM64::StackwalkerARM64(const SystemInfo* system_info,
|
||||
const MDRawContextARM64* context,
|
||||
const MDRawContextARM64_Old* context,
|
||||
MemoryRegion* memory,
|
||||
const CodeModules* modules,
|
||||
StackFrameSymbolizer* resolver_helper)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class StackwalkerARM64 : public Stackwalker {
|
|||
// included in the stack. The other arguments are passed directly through
|
||||
// to the base Stackwalker constructor.
|
||||
StackwalkerARM64(const SystemInfo* system_info,
|
||||
const MDRawContextARM64* context,
|
||||
const MDRawContextARM64_Old* context,
|
||||
MemoryRegion* memory,
|
||||
const CodeModules* modules,
|
||||
StackFrameSymbolizer* frame_symbolizer);
|
||||
|
|
@ -89,7 +89,7 @@ class StackwalkerARM64 : public Stackwalker {
|
|||
|
||||
// Stores the CPU context corresponding to the youngest stack frame, to
|
||||
// be returned by GetContextFrame.
|
||||
const MDRawContextARM64* context_;
|
||||
const MDRawContextARM64_Old* context_;
|
||||
|
||||
// Validity mask for youngest stack frame. This is always
|
||||
// CONTEXT_VALID_ALL in real use; it is only changeable for the sake of
|
||||
|
|
|
|||
|
|
@ -122,14 +122,14 @@ class StackwalkerARM64Fixture {
|
|||
}
|
||||
|
||||
// Fill RAW_CONTEXT with pseudo-random data, for round-trip checking.
|
||||
void BrandContext(MDRawContextARM64 *raw_context) {
|
||||
void BrandContext(MDRawContextARM64_Old *raw_context) {
|
||||
uint8_t x = 173;
|
||||
for (size_t i = 0; i < sizeof(*raw_context); i++)
|
||||
reinterpret_cast<uint8_t *>(raw_context)[i] = (x += 17);
|
||||
}
|
||||
|
||||
SystemInfo system_info;
|
||||
MDRawContextARM64 raw_context;
|
||||
MDRawContextARM64_Old raw_context;
|
||||
Section stack_section;
|
||||
MockMemoryRegion stack_region;
|
||||
MockCodeModule module1;
|
||||
|
|
@ -688,7 +688,7 @@ struct CFIFixture: public StackwalkerARM64Fixture {
|
|||
}
|
||||
|
||||
// The values we expect to find for the caller's registers.
|
||||
MDRawContextARM64 expected;
|
||||
MDRawContextARM64_Old expected;
|
||||
|
||||
// The validity mask for expected.
|
||||
uint64_t expected_validity;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue