Support symbol dumping for ARMV8 iOS apps.

In my testing, ARM V8 object files and ARM V8 slices of universal binaries do
not contain debug_frame sections (at least at this time), and hence dump_syms
does not output CFI for ARM V8 even in the absence of the "-c" flag.

Patch by:blundell@chromium.org

BUG=542
R=qsr@chromium.org

Review URL: https://breakpad.appspot.com/642002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1222 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
qsr@chromium.org 2013-10-15 10:24:21 +00:00
parent 404c684751
commit 6fa386bfc6
2 changed files with 37 additions and 0 deletions

View file

@ -45,8 +45,27 @@
#define CPU_SUBTYPE_ARM_V7S (static_cast<cpu_subtype_t>(11)) #define CPU_SUBTYPE_ARM_V7S (static_cast<cpu_subtype_t>(11))
#endif // CPU_SUBTYPE_ARM_V7S #endif // CPU_SUBTYPE_ARM_V7S
#ifndef CPU_TYPE_ARM64
#define CPU_TYPE_ARM64 (static_cast<cpu_type_t>(16777228))
#endif // CPU_TYPE_ARM64
#ifndef CPU_SUBTYPE_ARM64_ALL
#define CPU_SUBTYPE_ARM64_ALL (static_cast<cpu_type_t>(0))
#endif // CPU_SUBTYPE_ARM64_ALL
namespace { namespace {
const NXArchInfo* ArchInfo_arm64() {
NXArchInfo* arm64 = new NXArchInfo;
*arm64 = *NXGetArchInfoFromCpuType(CPU_TYPE_ARM,
CPU_SUBTYPE_ARM_V7);
arm64->name = "arm64";
arm64->cputype = CPU_TYPE_ARM64;
arm64->cpusubtype = CPU_SUBTYPE_ARM64_ALL;
arm64->description = "arm 64";
return arm64;
}
const NXArchInfo* ArchInfo_armv7s() { const NXArchInfo* ArchInfo_armv7s() {
NXArchInfo* armv7s = new NXArchInfo; NXArchInfo* armv7s = new NXArchInfo;
*armv7s = *NXGetArchInfoFromCpuType(CPU_TYPE_ARM, *armv7s = *NXGetArchInfoFromCpuType(CPU_TYPE_ARM,
@ -62,19 +81,32 @@ const NXArchInfo* ArchInfo_armv7s() {
namespace google_breakpad { namespace google_breakpad {
const NXArchInfo* BreakpadGetArchInfoFromName(const char* arch_name) { const NXArchInfo* BreakpadGetArchInfoFromName(const char* arch_name) {
// TODO: Remove this when the OS knows about arm64.
if (!strcmp("arm64", arch_name))
return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM64,
CPU_SUBTYPE_ARM64_ALL);
// TODO: Remove this when the OS knows about armv7s. // TODO: Remove this when the OS knows about armv7s.
if (!strcmp("armv7s", arch_name)) if (!strcmp("armv7s", arch_name))
return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7S); return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7S);
return NXGetArchInfoFromName(arch_name); return NXGetArchInfoFromName(arch_name);
} }
const NXArchInfo* BreakpadGetArchInfoFromCpuType(cpu_type_t cpu_type, const NXArchInfo* BreakpadGetArchInfoFromCpuType(cpu_type_t cpu_type,
cpu_subtype_t cpu_subtype) { cpu_subtype_t cpu_subtype) {
// TODO: Remove this when the OS knows about arm64.
if (cpu_type == CPU_TYPE_ARM64 && cpu_subtype == CPU_SUBTYPE_ARM64_ALL) {
static const NXArchInfo* arm64 = ArchInfo_arm64();
return arm64;
}
// TODO: Remove this when the OS knows about armv7s. // TODO: Remove this when the OS knows about armv7s.
if (cpu_type == CPU_TYPE_ARM && cpu_subtype == CPU_SUBTYPE_ARM_V7S) { if (cpu_type == CPU_TYPE_ARM && cpu_subtype == CPU_SUBTYPE_ARM_V7S) {
static const NXArchInfo* armv7s = ArchInfo_armv7s(); static const NXArchInfo* armv7s = ArchInfo_armv7s();
return armv7s; return armv7s;
} }
return NXGetArchInfoFromCpuType(cpu_type, cpu_subtype); return NXGetArchInfoFromCpuType(cpu_type, cpu_subtype);
} }

View file

@ -43,6 +43,10 @@
#define CPU_TYPE_ARM 12 #define CPU_TYPE_ARM 12
#endif #endif
#if !defined(CPU_TYPE_ARM_64)
#define CPU_TYPE_ARM_64 16777228
#endif
namespace google_breakpad { namespace google_breakpad {
namespace mach_o { namespace mach_o {
@ -242,6 +246,7 @@ bool Reader::Read(const uint8_t *buffer,
case CPU_TYPE_POWERPC: case CPU_TYPE_POWERPC:
expected_magic = MH_MAGIC; expected_magic = MH_MAGIC;
break; break;
case CPU_TYPE_ARM_64:
case CPU_TYPE_X86_64: case CPU_TYPE_X86_64:
expected_magic = MH_CIGAM_64; expected_magic = MH_CIGAM_64;
break; break;