From 6446cfcff088b8682ba473f65f9f4f95e780c894 Mon Sep 17 00:00:00 2001 From: "qsr@chromium.org" Date: Tue, 25 Sep 2012 08:30:48 +0000 Subject: [PATCH] processor: add arm exception flags From inspection of Apple headers and https://llvm.org/svn/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Review: https://breakpad.appspot.com/457003/ Patch by: jaysoffian@gmail.com git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1048 4c0a9323-5329-0410-9bdc-e9ce6186880e --- .../common/minidump_exception_mac.h | 10 +++ src/processor/minidump_processor.cc | 79 ++++++++++++++++--- 2 files changed, 76 insertions(+), 13 deletions(-) diff --git a/src/google_breakpad/common/minidump_exception_mac.h b/src/google_breakpad/common/minidump_exception_mac.h index 01f8febb..91c1c097 100644 --- a/src/google_breakpad/common/minidump_exception_mac.h +++ b/src/google_breakpad/common/minidump_exception_mac.h @@ -93,6 +93,16 @@ typedef enum { /* Custom values */ MD_EXCEPTION_CODE_MAC_NS_EXCEPTION = 0xDEADC0DE, /* uncaught NSException */ + /* With MD_EXCEPTION_MAC_BAD_ACCESS on arm */ + MD_EXCEPTION_CODE_MAC_ARM_DA_ALIGN = 0x0101, /* EXC_ARM_DA_ALIGN */ + MD_EXCEPTION_CODE_MAC_ARM_DA_DEBUG = 0x0102, /* EXC_ARM_DA_DEBUG */ + + /* With MD_EXCEPTION_MAC_BAD_INSTRUCTION on arm */ + MD_EXCEPTION_CODE_MAC_ARM_UNDEFINED = 1, /* EXC_ARM_UNDEFINED */ + + /* With MD_EXCEPTION_MAC_BREAKPOINT on arm */ + MD_EXCEPTION_CODE_MAC_ARM_BREAKPOINT = 1, /* EXC_ARM_BREAKPOINT */ + /* With MD_EXCEPTION_MAC_BAD_ACCESS on ppc */ MD_EXCEPTION_CODE_MAC_PPC_VM_PROT_READ = 0x0101, /* EXC_PPC_VM_PROT_READ */ diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc index 0f9d8d75..814402be 100644 --- a/src/processor/minidump_processor.cc +++ b/src/processor/minidump_processor.cc @@ -484,26 +484,61 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, u_int64_t *address) { case MD_EXCEPTION_CODE_MAC_MEMORY_ERROR: reason.append("KERN_MEMORY_ERROR"); break; - // These are ppc only but shouldn't be a problem as they're - // unused on x86 - case MD_EXCEPTION_CODE_MAC_PPC_VM_PROT_READ: - reason.append("EXC_PPC_VM_PROT_READ"); - break; - case MD_EXCEPTION_CODE_MAC_PPC_BADSPACE: - reason.append("EXC_PPC_BADSPACE"); - break; - case MD_EXCEPTION_CODE_MAC_PPC_UNALIGNED: - reason.append("EXC_PPC_UNALIGNED"); - break; default: - reason.append(flags_string); - BPLOG(INFO) << "Unknown exception reason " << reason; + // arm and ppc overlap + if (raw_system_info->processor_architecture == + MD_CPU_ARCHITECTURE_ARM) { + switch (exception_flags) { + case MD_EXCEPTION_CODE_MAC_ARM_DA_ALIGN: + reason.append("EXC_ARM_DA_ALIGN"); + break; + case MD_EXCEPTION_CODE_MAC_ARM_DA_DEBUG: + reason.append("EXC_ARM_DA_DEBUG"); + break; + default: + reason.append(flags_string); + BPLOG(INFO) << "Unknown exception reason " << reason; + break; + } + } else if (raw_system_info->processor_architecture == + MD_CPU_ARCHITECTURE_PPC) { + switch (exception_flags) { + case MD_EXCEPTION_CODE_MAC_PPC_VM_PROT_READ: + reason.append("EXC_PPC_VM_PROT_READ"); + break; + case MD_EXCEPTION_CODE_MAC_PPC_BADSPACE: + reason.append("EXC_PPC_BADSPACE"); + break; + case MD_EXCEPTION_CODE_MAC_PPC_UNALIGNED: + reason.append("EXC_PPC_UNALIGNED"); + break; + default: + reason.append(flags_string); + BPLOG(INFO) << "Unknown exception reason " << reason; + break; + } + } else { + reason.append(flags_string); + BPLOG(INFO) << "Unknown exception reason " << reason; + } break; } break; case MD_EXCEPTION_MAC_BAD_INSTRUCTION: reason = "EXC_BAD_INSTRUCTION / "; switch (raw_system_info->processor_architecture) { + case MD_CPU_ARCHITECTURE_ARM: { + switch (exception_flags) { + case MD_EXCEPTION_CODE_MAC_ARM_UNDEFINED: + reason.append("EXC_ARM_UNDEFINED"); + break; + default: + reason.append(flags_string); + BPLOG(INFO) << "Unknown exception reason " << reason; + break; + } + break; + } case MD_CPU_ARCHITECTURE_PPC: { switch (exception_flags) { case MD_EXCEPTION_CODE_MAC_PPC_INVALID_SYSCALL: @@ -671,6 +706,24 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, u_int64_t *address) { case MD_EXCEPTION_MAC_BREAKPOINT: reason = "EXC_BREAKPOINT / "; switch (raw_system_info->processor_architecture) { + case MD_CPU_ARCHITECTURE_ARM: { + switch (exception_flags) { + case MD_EXCEPTION_CODE_MAC_ARM_DA_ALIGN: + reason.append("EXC_ARM_DA_ALIGN"); + break; + case MD_EXCEPTION_CODE_MAC_ARM_DA_DEBUG: + reason.append("EXC_ARM_DA_DEBUG"); + break; + case MD_EXCEPTION_CODE_MAC_ARM_BREAKPOINT: + reason.append("EXC_ARM_BREAKPOINT"); + break; + default: + reason.append(flags_string); + BPLOG(INFO) << "Unknown exception reason " << reason; + break; + } + break; + } case MD_CPU_ARCHITECTURE_PPC: { switch (exception_flags) { case MD_EXCEPTION_CODE_MAC_PPC_BREAKPOINT: