add aarch64 support to minidump-2-core
The thread info expects the struct names as they expect in asm/ptrace.h, but the header doesn't include that, it includes sys/user.h. Rename the reg structs to match that header. Rename the elf_siginfo to _elf_siginfo to avoid conflicting with the one in the sys/procfs.h. It is only used locally in one place, so we don't need to update any callers. Otherwise, drop in aarch64 support into the minidump-2-core file. BUG=chromium:334368 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1474 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
0295bfea40
commit
398384e1cf
@ -65,9 +65,9 @@ struct ThreadInfo {
|
|||||||
struct user_regs regs;
|
struct user_regs regs;
|
||||||
struct user_fpregs fpregs;
|
struct user_fpregs fpregs;
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
// Use the structures defined in <asm/ptrace.h>
|
// Use the structures defined in <sys/user.h>
|
||||||
struct user_pt_regs regs;
|
struct user_regs_struct regs;
|
||||||
struct user_fpsimd_state fpregs;
|
struct user_fpsimd_struct fpregs;
|
||||||
#elif defined(__mips__)
|
#elif defined(__mips__)
|
||||||
// Use the structure defined in <sys/ucontext.h>.
|
// Use the structure defined in <sys/ucontext.h>.
|
||||||
mcontext_t mcontext;
|
mcontext_t mcontext;
|
||||||
|
@ -74,6 +74,8 @@
|
|||||||
#define ELF_ARCH EM_ARM
|
#define ELF_ARCH EM_ARM
|
||||||
#elif defined(__mips__)
|
#elif defined(__mips__)
|
||||||
#define ELF_ARCH EM_MIPS
|
#define ELF_ARCH EM_MIPS
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#define ELF_ARCH EM_AARCH64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__arm__)
|
#if defined(__arm__)
|
||||||
@ -136,14 +138,14 @@ typedef struct elf_timeval { /* Time value with microsecond resolution */
|
|||||||
long tv_usec; /* Microseconds */
|
long tv_usec; /* Microseconds */
|
||||||
} elf_timeval;
|
} elf_timeval;
|
||||||
|
|
||||||
typedef struct elf_siginfo { /* Information about signal (unused) */
|
typedef struct _elf_siginfo { /* Information about signal (unused) */
|
||||||
int32_t si_signo; /* Signal number */
|
int32_t si_signo; /* Signal number */
|
||||||
int32_t si_code; /* Extra code */
|
int32_t si_code; /* Extra code */
|
||||||
int32_t si_errno; /* Errno */
|
int32_t si_errno; /* Errno */
|
||||||
} elf_siginfo;
|
} _elf_siginfo;
|
||||||
|
|
||||||
typedef struct prstatus { /* Information about thread; includes CPU reg*/
|
typedef struct prstatus { /* Information about thread; includes CPU reg*/
|
||||||
elf_siginfo pr_info; /* Info associated with signal */
|
_elf_siginfo pr_info; /* Info associated with signal */
|
||||||
uint16_t pr_cursig; /* Current signal */
|
uint16_t pr_cursig; /* Current signal */
|
||||||
unsigned long pr_sigpend; /* Set of pending signals */
|
unsigned long pr_sigpend; /* Set of pending signals */
|
||||||
unsigned long pr_sighold; /* Set of held signals */
|
unsigned long pr_sighold; /* Set of held signals */
|
||||||
@ -213,15 +215,18 @@ struct CrashedProcess {
|
|||||||
pid_t tid;
|
pid_t tid;
|
||||||
#if defined(__mips__)
|
#if defined(__mips__)
|
||||||
mcontext_t mcontext;
|
mcontext_t mcontext;
|
||||||
#else // __mips__
|
#else
|
||||||
user_regs_struct regs;
|
user_regs_struct regs;
|
||||||
|
#endif
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
user_fpregs_struct fpregs;
|
user_fpregs_struct fpregs;
|
||||||
#endif // __i386__ || __x86_64__
|
#endif
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
user_fpxregs_struct fpxregs;
|
user_fpxregs_struct fpxregs;
|
||||||
#endif // __i386__
|
#endif
|
||||||
#endif // __mips__
|
#if defined(__aarch64__)
|
||||||
|
user_fpsimd_struct fpregs;
|
||||||
|
#endif
|
||||||
uintptr_t stack_addr;
|
uintptr_t stack_addr;
|
||||||
const uint8_t* stack;
|
const uint8_t* stack;
|
||||||
size_t stack_length;
|
size_t stack_length;
|
||||||
@ -371,6 +376,22 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
|
|||||||
thread->regs.uregs[16] = rawregs->cpsr;
|
thread->regs.uregs[16] = rawregs->cpsr;
|
||||||
thread->regs.uregs[17] = 0; // what is ORIG_r0 exactly?
|
thread->regs.uregs[17] = 0; // what is ORIG_r0 exactly?
|
||||||
}
|
}
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
static void
|
||||||
|
ParseThreadRegisters(CrashedProcess::Thread* thread,
|
||||||
|
const MinidumpMemoryRange& range) {
|
||||||
|
const MDRawContextARM64* rawregs = range.GetData<MDRawContextARM64>(0);
|
||||||
|
|
||||||
|
for (int i = 0; i < 31; ++i)
|
||||||
|
thread->regs.regs[i] = rawregs->iregs[i];
|
||||||
|
thread->regs.sp = rawregs->iregs[MD_CONTEXT_ARM64_REG_SP];
|
||||||
|
thread->regs.pc = rawregs->iregs[MD_CONTEXT_ARM64_REG_PC];
|
||||||
|
thread->regs.pstate = rawregs->cpsr;
|
||||||
|
|
||||||
|
memcpy(thread->fpregs.vregs, rawregs->float_save.regs, 8 * 32);
|
||||||
|
thread->fpregs.fpsr = rawregs->float_save.fpsr;
|
||||||
|
thread->fpregs.fpcr = rawregs->float_save.fpcr;
|
||||||
|
}
|
||||||
#elif defined(__mips__)
|
#elif defined(__mips__)
|
||||||
static void
|
static void
|
||||||
ParseThreadRegisters(CrashedProcess::Thread* thread,
|
ParseThreadRegisters(CrashedProcess::Thread* thread,
|
||||||
@ -466,6 +487,12 @@ ParseSystemInfo(CrashedProcess* crashinfo, const MinidumpMemoryRange& range,
|
|||||||
"This version of minidump-2-core only supports ARM (32bit).\n");
|
"This version of minidump-2-core only supports ARM (32bit).\n");
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_ARM64) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"This version of minidump-2-core only supports ARM (64bit).\n");
|
||||||
|
_exit(1);
|
||||||
|
}
|
||||||
#elif defined(__mips__)
|
#elif defined(__mips__)
|
||||||
if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_MIPS) {
|
if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_MIPS) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user