mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-23 12:55:29 +00:00
First cut at adding arm64 Linux / Android support to Breakpad.
This is an initial attempt to add Arm64 (aarch64) support to Breakpad for Linux / Android platforms. This CL adds the Arm64 data structures, but does not yet implement the Android getcontext support or CPUFillFromThreadInfo / CPUFillFromUContext. BUG=354405,335641 R=mark@chromium.org Review URL: https://breakpad.appspot.com/1354002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1301 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
46aba5a43a
commit
83b9a28cf9
|
@ -398,8 +398,8 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) {
|
|||
CrashContext context;
|
||||
memcpy(&context.siginfo, info, sizeof(siginfo_t));
|
||||
memcpy(&context.context, uc, sizeof(struct ucontext));
|
||||
#if !defined(__ARM_EABI__) && !defined(__mips__)
|
||||
// FP state is not part of user ABI on ARM Linux.
|
||||
#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
|
||||
// FP state is not part of user ABI on ARM or ARM64 Linux.
|
||||
// In case of MIPS Linux FP state is already part of struct ucontext
|
||||
// and 'float_state' is not a member of CrashContext.
|
||||
struct ucontext *uc_ptr = (struct ucontext*)uc;
|
||||
|
@ -608,7 +608,7 @@ bool ExceptionHandler::WriteMinidump() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(__ARM_EABI__) && !defined(__mips__)
|
||||
#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
|
||||
// FPU state is not part of ARM EABI ucontext_t.
|
||||
memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
|
||||
sizeof(context.float_state));
|
||||
|
@ -627,6 +627,9 @@ bool ExceptionHandler::WriteMinidump() {
|
|||
#elif defined(__arm__)
|
||||
context.siginfo.si_addr =
|
||||
reinterpret_cast<void*>(context.context.uc_mcontext.arm_pc);
|
||||
#elif defined(__aarch64__)
|
||||
context.siginfo.si_addr =
|
||||
reinterpret_cast<void*>(context.context.uc_mcontext.pc);
|
||||
#elif defined(__mips__)
|
||||
context.siginfo.si_addr =
|
||||
reinterpret_cast<void*>(context.context.uc_mcontext.pc);
|
||||
|
|
|
@ -190,10 +190,10 @@ class ExceptionHandler {
|
|||
siginfo_t siginfo;
|
||||
pid_t tid; // the crashing thread.
|
||||
struct ucontext context;
|
||||
#if !defined(__ARM_EABI__) && !defined(__mips__)
|
||||
// #ifdef this out because FP state is not part of user ABI for Linux ARM.
|
||||
// In case of MIPS Linux FP state is already part of struct ucontext
|
||||
// so 'float_state' is not required.
|
||||
#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
|
||||
// #ifdef this out because FP state is not part of user ABI for Linux ARM
|
||||
// or ARM64. In case of MIPS Linux FP state is already part of struct
|
||||
// ucontext so 'float_state' is not required.
|
||||
struct _libc_fpstate float_state;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -99,6 +99,8 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
|
|||
memcpy(&stack_pointer, &info->regs.rsp, sizeof(info->regs.rsp));
|
||||
#elif defined(__ARM_EABI__)
|
||||
memcpy(&stack_pointer, &info->regs.ARM_sp, sizeof(info->regs.ARM_sp));
|
||||
#elif defined(__aarch64__)
|
||||
memcpy(&stack_pointer, &info->regs.sp, sizeof(info->regs.sp));
|
||||
#elif defined(__mips__)
|
||||
stack_pointer =
|
||||
reinterpret_cast<uint8_t*>(info->regs.regs[MD_CONTEXT_MIPS_REG_SP]);
|
||||
|
|
|
@ -56,7 +56,7 @@ typedef typeof(((struct user*) 0)->u_debugreg[0]) debugreg_t;
|
|||
// Typedef for our parsing of the auxv variables in /proc/pid/auxv.
|
||||
#if defined(__i386) || defined(__ARM_EABI__) || defined(__mips__)
|
||||
typedef Elf32_auxv_t elf_aux_entry;
|
||||
#elif defined(__x86_64)
|
||||
#elif defined(__x86_64) || defined(__aarch64__)
|
||||
typedef Elf64_auxv_t elf_aux_entry;
|
||||
#endif
|
||||
|
||||
|
@ -88,6 +88,10 @@ struct ThreadInfo {
|
|||
// Mimicking how strace does this(see syscall.c, search for GETREGS)
|
||||
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;
|
||||
#elif defined(__mips__)
|
||||
user_regs_struct regs;
|
||||
user_fpregs_struct fpregs;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#if defined(__i386)
|
||||
|
@ -186,6 +187,20 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
|
|||
if (info->ppid == -1 || info->tgid == -1)
|
||||
return false;
|
||||
|
||||
#ifdef PTRACE_GETREGSET
|
||||
struct iovec io;
|
||||
io.iov_base = &info->regs;
|
||||
io.iov_len = sizeof(info->regs);
|
||||
if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
io.iov_base = &info->fpregs;
|
||||
io.iov_len = sizeof(info->fpregs);
|
||||
if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (sys_ptrace(PTRACE_GETREGS, tid, NULL, &info->regs) == -1) {
|
||||
return false;
|
||||
}
|
||||
|
@ -193,6 +208,7 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
|
|||
if (sys_ptrace(PTRACE_GETFPREGS, tid, NULL, &info->fpregs) == -1) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__i386)
|
||||
#if !defined(bit_FXSAVE) // e.g. Clang
|
||||
|
@ -241,6 +257,8 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
|
|||
my_memcpy(&stack_pointer, &info->regs.rsp, sizeof(info->regs.rsp));
|
||||
#elif defined(__ARM_EABI__)
|
||||
my_memcpy(&stack_pointer, &info->regs.ARM_sp, sizeof(info->regs.ARM_sp));
|
||||
#elif defined(__aarch64__)
|
||||
my_memcpy(&stack_pointer, &info->regs.sp, sizeof(info->regs.sp));
|
||||
#elif defined(__mips__)
|
||||
stack_pointer =
|
||||
reinterpret_cast<uint8_t*>(info->regs.regs[MD_CONTEXT_MIPS_REG_SP]);
|
||||
|
|
|
@ -374,6 +374,19 @@ void CPUFillFromUContext(MDRawContextARM* out, const ucontext* uc,
|
|||
my_memset(&out->float_save.extra, 0, sizeof(out->float_save.extra));
|
||||
}
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
typedef MDRawContextARM64 RawContextCPU;
|
||||
|
||||
void CPUFillFromThreadInfo(MDRawContextARM64* out,
|
||||
const google_breakpad::ThreadInfo& info) {
|
||||
// TODO(rmcilroy): Implement for arm64.
|
||||
}
|
||||
|
||||
void CPUFillFromUContext(MDRawContextARM64* out, const ucontext* uc,
|
||||
const struct _libc_fpstate* fpregs) {
|
||||
// TODO(rmcilroy): Implement for arm64.
|
||||
}
|
||||
|
||||
#elif defined(__mips__)
|
||||
typedef MDRawContextMIPS RawContextCPU;
|
||||
|
||||
|
@ -470,7 +483,7 @@ class MinidumpWriter {
|
|||
: fd_(minidump_fd),
|
||||
path_(minidump_path),
|
||||
ucontext_(context ? &context->context : NULL),
|
||||
#if !defined(__ARM_EABI__) && !defined(__mips__)
|
||||
#if !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__aarch64__)
|
||||
float_state_(context ? &context->float_state : NULL),
|
||||
#else
|
||||
// TODO: fix this after fixing ExceptionHandler
|
||||
|
@ -1271,6 +1284,18 @@ class MinidumpWriter {
|
|||
uintptr_t GetInstructionPointer(const ThreadInfo& info) {
|
||||
return info.regs.uregs[15];
|
||||
}
|
||||
#elif defined(__aarch64__)
|
||||
uintptr_t GetStackPointer() {
|
||||
return ucontext_->uc_mcontext.sp;
|
||||
}
|
||||
|
||||
uintptr_t GetInstructionPointer() {
|
||||
return ucontext_->uc_mcontext.pc;
|
||||
}
|
||||
|
||||
uintptr_t GetInstructionPointer(const ThreadInfo& info) {
|
||||
return info.regs.pc;
|
||||
}
|
||||
#elif defined(__mips__)
|
||||
uintptr_t GetStackPointer() {
|
||||
return ucontext_->uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP];
|
||||
|
@ -1581,6 +1606,11 @@ class MinidumpWriter {
|
|||
|
||||
return true;
|
||||
}
|
||||
#elif defined(__aarch64__)
|
||||
bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
|
||||
// TODO(rmcilroy): Implement for arm64.
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
# error "Unsupported CPU"
|
||||
#endif
|
||||
|
|
|
@ -140,6 +140,10 @@ breakpad_getcontext:
|
|||
|
||||
.size breakpad_getcontext, . - breakpad_getcontext
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
|
||||
// TODO(rmcilroy): Implement for arm64.
|
||||
|
||||
#elif defined(__mips__)
|
||||
|
||||
#if _MIPS_SIM != _ABIO32
|
||||
|
|
|
@ -110,9 +110,14 @@ typedef struct {
|
|||
|
||||
|
||||
// __WORDSIZE is GLibc-specific and used by Google Breakpad on Linux.
|
||||
// All Android platforms are 32-bit for now.
|
||||
#ifndef __WORDSIZE
|
||||
#if defined(__i386__) || defined(__ARM_EABI__) || defined(__mips__)
|
||||
#define __WORDSIZE 32
|
||||
#elif defined(__x86_64__) || defined(__aarch64__)
|
||||
#define __WORDSIZE 64
|
||||
#else
|
||||
#error "Unsupported Android CPU ABI"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// The Android headers don't always define this constant.
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
Provide custom version here. */
|
||||
#include_next <link.h>
|
||||
|
||||
// TODO(rmcilroy): Remove this file once the ndk is updated for other
|
||||
// architectures - crbug.com/358831
|
||||
#if !defined(__aarch64__) && !defined(__x86_64__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
@ -61,4 +65,6 @@ struct link_map {
|
|||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !defined(__aarch64__) && !defined(__x86_64__)
|
||||
|
||||
#endif /* GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H */
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __x86_64__
|
||||
#if defined(__x86_64__) || defined(__aarch64__)
|
||||
typedef unsigned long long elf_greg_t;
|
||||
#else
|
||||
typedef unsigned long elf_greg_t;
|
||||
|
@ -52,6 +52,8 @@ typedef unsigned long elf_greg_t;
|
|||
|
||||
#ifdef __arm__
|
||||
#define ELF_NGREG (sizeof(struct user_regs) / sizeof(elf_greg_t))
|
||||
#elif defined(__aarch64__)
|
||||
#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t))
|
||||
#else
|
||||
#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
|
||||
#endif
|
||||
|
|
|
@ -62,6 +62,19 @@ typedef struct ucontext {
|
|||
// Other fields are not used by Google Breakpad. Don't define them.
|
||||
} ucontext_t;
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
|
||||
#include <asm/sigcontext.h>
|
||||
typedef struct sigcontext mcontext_t;
|
||||
|
||||
typedef struct ucontext {
|
||||
unsigned long uc_flags;
|
||||
struct ucontext *uc_link;
|
||||
stack_t uc_stack;
|
||||
sigset_t uc_sigmask;
|
||||
mcontext_t uc_mcontext;
|
||||
} ucontext_t;
|
||||
|
||||
#elif defined(__i386__)
|
||||
|
||||
/* 80-bit floating-point register */
|
||||
|
|
|
@ -75,6 +75,11 @@ struct user_vfpregs {
|
|||
unsigned long fpscr;
|
||||
};
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
|
||||
// aarch64 does not have user_regs definitions in <asm/user.h>, instead
|
||||
// use the definitions in <asm/ptrace.h>, which we don't need to redefine here.
|
||||
|
||||
#elif defined(__i386__)
|
||||
|
||||
#define _I386_USER_H 1 // Prevent <asm/user.h> conflicts
|
||||
|
|
|
@ -45,6 +45,11 @@
|
|||
#define MCONTEXT_GREGS_OFFSET 32
|
||||
#define UCONTEXT_SIGMASK_OFFSET 104
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
|
||||
#define MCONTEXT_GREGS_OFFSET 56
|
||||
#define UCONTEXT_SIGMASK_OFFSET 40
|
||||
|
||||
#elif defined(__i386__)
|
||||
|
||||
#define MCONTEXT_GREGS_OFFSET 20
|
||||
|
|
|
@ -62,7 +62,7 @@ bool MemoryMappedFile::Map(const char* path) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#if defined(__x86_64__) || defined(__aarch64__)
|
||||
struct kernel_stat st;
|
||||
if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
|
||||
#else
|
||||
|
@ -81,7 +81,7 @@ bool MemoryMappedFile::Map(const char* path) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#if defined(__x86_64__) || defined(__aarch64__)
|
||||
void* data = sys_mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
#else
|
||||
void* data = sys_mmap2(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
|
|
|
@ -110,7 +110,7 @@ class PageAllocator {
|
|||
|
||||
private:
|
||||
uint8_t *GetNPages(size_t num_pages) {
|
||||
#ifdef __x86_64
|
||||
#if defined(__x86_64__) || defined(__aarch64__)
|
||||
void *a = sys_mmap(NULL, page_size_ * num_pages, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
#else
|
||||
|
|
6
src/third_party/curl/curlbuild.h
vendored
6
src/third_party/curl/curlbuild.h
vendored
|
@ -154,7 +154,8 @@
|
|||
#endif
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#if defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__))
|
||||
#if defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__)) || \
|
||||
defined(__aarch64__)
|
||||
#define CURL_SIZEOF_LONG 8
|
||||
#else
|
||||
#define CURL_SIZEOF_LONG 4
|
||||
|
@ -170,7 +171,8 @@
|
|||
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
|
||||
|
||||
/* Signed integral data type used for curl_off_t. */
|
||||
#if defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__))
|
||||
#if defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__)) || \
|
||||
defined(__aarch64__)
|
||||
#define CURL_TYPEOF_CURL_OFF_T long
|
||||
#else
|
||||
#define CURL_TYPEOF_CURL_OFF_T int64_t
|
||||
|
|
Loading…
Reference in a new issue