mirror of
https://github.com/yuzu-emu/breakpad
synced 2024-11-23 19:13:35 +00:00
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
85e4cf8029
commit
0b7c158932
2 changed files with 37 additions and 10 deletions
|
@ -65,9 +65,9 @@ struct ThreadInfo {
|
|||
struct user_regs regs;
|
||||
struct user_fpregs fpregs;
|
||||
#elif defined(__aarch64__)
|
||||
// Use the structures defined in <asm/ptrace.h>
|
||||
struct user_pt_regs regs;
|
||||
struct user_fpsimd_state fpregs;
|
||||
// Use the structures defined in <sys/user.h>
|
||||
struct user_regs_struct regs;
|
||||
struct user_fpsimd_struct fpregs;
|
||||
#elif defined(__mips__)
|
||||
// Use the structure defined in <sys/ucontext.h>.
|
||||
mcontext_t mcontext;
|
||||
|
|
|
@ -74,6 +74,8 @@
|
|||
#define ELF_ARCH EM_ARM
|
||||
#elif defined(__mips__)
|
||||
#define ELF_ARCH EM_MIPS
|
||||
#elif defined(__aarch64__)
|
||||
#define ELF_ARCH EM_AARCH64
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
|
@ -136,14 +138,14 @@ typedef struct elf_timeval { /* Time value with microsecond resolution */
|
|||
long tv_usec; /* Microseconds */
|
||||
} 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_code; /* Extra code */
|
||||
int32_t si_errno; /* Errno */
|
||||
} elf_siginfo;
|
||||
} _elf_siginfo;
|
||||
|
||||
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 */
|
||||
unsigned long pr_sigpend; /* Set of pending signals */
|
||||
unsigned long pr_sighold; /* Set of held signals */
|
||||
|
@ -213,15 +215,18 @@ struct CrashedProcess {
|
|||
pid_t tid;
|
||||
#if defined(__mips__)
|
||||
mcontext_t mcontext;
|
||||
#else // __mips__
|
||||
#else
|
||||
user_regs_struct regs;
|
||||
#endif
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
user_fpregs_struct fpregs;
|
||||
#endif // __i386__ || __x86_64__
|
||||
#endif
|
||||
#if defined(__i386__)
|
||||
user_fpxregs_struct fpxregs;
|
||||
#endif // __i386__
|
||||
#endif // __mips__
|
||||
#endif
|
||||
#if defined(__aarch64__)
|
||||
user_fpsimd_struct fpregs;
|
||||
#endif
|
||||
uintptr_t stack_addr;
|
||||
const uint8_t* stack;
|
||||
size_t stack_length;
|
||||
|
@ -371,6 +376,22 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
|
|||
thread->regs.uregs[16] = rawregs->cpsr;
|
||||
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__)
|
||||
static void
|
||||
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");
|
||||
_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__)
|
||||
if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_MIPS) {
|
||||
fprintf(stderr,
|
||||
|
|
Loading…
Reference in a new issue