mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-22 19:55:42 +00:00
Update breakpad to support Android NDK r10c
Prior to NDK r10c, Breakpad was privately backporting these system headers. This change is now unforking and removing those headers and using the ones from the NDK. Rationale: - They are finally available in the NDK, so there is no need to keep maintaining a fork (which was necessary up until recently to support arm64). - These forked headers, as they are today, are not compatible with the latest NDK (i.e. this change is required to roll NDK r10c). The forked ucontext.h, being removed by this CL, depends on some transitional features which are not compatible with the NDK release being targeted here. After this change, the NDK r10c is now required to build Breakpad on Android. Note that NDK releases are backwards compatible and contain all the previous API levels, so this change is NOT effectively enforcing to build against any particular Android SDK. Submitting this on behalf of fdegans@chromium.org BUG=chromium:358831 R=mark@chromium.org, primiano@chromium.org, rmcilroy@chromium.org git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1396 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
e1be1aa1ec
commit
c1c257f4f6
|
@ -6,6 +6,7 @@ on Android, and later generate valid stack traces from the minidumps
|
|||
it generates.
|
||||
|
||||
This release supports ARM, x86 and MIPS based Android systems.
|
||||
This release requires NDK release r10c or higher.
|
||||
|
||||
I. Building the client library:
|
||||
===============================
|
||||
|
@ -36,8 +37,8 @@ NOTE: The client library requires a C++ STL implementation,
|
|||
It has been tested succesfully with both STLport and GNU libstdc++
|
||||
|
||||
|
||||
II.1. Building with a standalone Android toolchain:
|
||||
---------------------------------------------------
|
||||
I.2. Building with a standalone Android toolchain:
|
||||
--------------------------------------------------
|
||||
|
||||
All you need to do is configure your build with the right 'host'
|
||||
value, and disable the processor and tools, as in:
|
||||
|
|
|
@ -1,255 +0,0 @@
|
|||
// Copyright (c) 2012, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_UCONTEXT_H
|
||||
#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_UCONTEXT_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __BIONIC_HAVE_UCONTEXT_T
|
||||
|
||||
// Ensure that 'stack_t' is defined.
|
||||
#include <asm/signal.h>
|
||||
|
||||
// This version of the Android C library headers do not provide ucontext_t.
|
||||
// Provide custom definitions for Google Breakpad.
|
||||
#if defined(__arm__)
|
||||
|
||||
// Ensure that 'struct sigcontext' is defined.
|
||||
#include <asm/sigcontext.h>
|
||||
typedef struct sigcontext mcontext_t;
|
||||
|
||||
// The ARM kernel uses a 64-bit signal mask.
|
||||
typedef uint32_t kernel_sigmask_t[2];
|
||||
|
||||
typedef struct ucontext {
|
||||
uint32_t uc_flags;
|
||||
struct ucontext* uc_link;
|
||||
stack_t uc_stack;
|
||||
mcontext_t uc_mcontext;
|
||||
kernel_sigmask_t uc_sigmask;
|
||||
// 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;
|
||||
char __padding[128 - sizeof(sigset_t)];
|
||||
mcontext_t uc_mcontext;
|
||||
} ucontext_t;
|
||||
|
||||
#elif defined(__i386__)
|
||||
|
||||
/* 80-bit floating-point register */
|
||||
struct _libc_fpreg {
|
||||
unsigned short significand[4];
|
||||
unsigned short exponent;
|
||||
};
|
||||
|
||||
/* Simple floating-point state, see FNSTENV instruction */
|
||||
struct _libc_fpstate {
|
||||
unsigned long cw;
|
||||
unsigned long sw;
|
||||
unsigned long tag;
|
||||
unsigned long ipoff;
|
||||
unsigned long cssel;
|
||||
unsigned long dataoff;
|
||||
unsigned long datasel;
|
||||
struct _libc_fpreg _st[8];
|
||||
unsigned long status;
|
||||
};
|
||||
|
||||
typedef uint32_t greg_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t gregs[19];
|
||||
struct _libc_fpstate* fpregs;
|
||||
uint32_t oldmask;
|
||||
uint32_t cr2;
|
||||
} mcontext_t;
|
||||
|
||||
enum {
|
||||
REG_GS = 0,
|
||||
REG_FS,
|
||||
REG_ES,
|
||||
REG_DS,
|
||||
REG_EDI,
|
||||
REG_ESI,
|
||||
REG_EBP,
|
||||
REG_ESP,
|
||||
REG_EBX,
|
||||
REG_EDX,
|
||||
REG_ECX,
|
||||
REG_EAX,
|
||||
REG_TRAPNO,
|
||||
REG_ERR,
|
||||
REG_EIP,
|
||||
REG_CS,
|
||||
REG_EFL,
|
||||
REG_UESP,
|
||||
REG_SS,
|
||||
};
|
||||
|
||||
// The i386 kernel uses a 64-bit signal mask.
|
||||
typedef uint32_t kernel_sigmask_t[2];
|
||||
|
||||
typedef struct ucontext {
|
||||
uint32_t uc_flags;
|
||||
struct ucontext* uc_link;
|
||||
stack_t uc_stack;
|
||||
mcontext_t uc_mcontext;
|
||||
kernel_sigmask_t uc_sigmask;
|
||||
struct _libc_fpstate __fpregs_mem;
|
||||
} ucontext_t;
|
||||
|
||||
#elif defined(__mips__)
|
||||
|
||||
typedef struct {
|
||||
uint32_t regmask;
|
||||
uint32_t status;
|
||||
uint64_t pc;
|
||||
uint64_t gregs[32];
|
||||
uint64_t fpregs[32];
|
||||
uint32_t acx;
|
||||
uint32_t fpc_csr;
|
||||
uint32_t fpc_eir;
|
||||
uint32_t used_math;
|
||||
uint32_t dsp;
|
||||
uint64_t mdhi;
|
||||
uint64_t mdlo;
|
||||
uint32_t hi1;
|
||||
uint32_t lo1;
|
||||
uint32_t hi2;
|
||||
uint32_t lo2;
|
||||
uint32_t hi3;
|
||||
uint32_t lo3;
|
||||
} mcontext_t;
|
||||
|
||||
// The MIPS kernel uses a 128-bit signal mask.
|
||||
typedef uint32_t kernel_sigmask_t[4];
|
||||
|
||||
typedef struct ucontext {
|
||||
uint32_t uc_flags;
|
||||
struct ucontext* uc_link;
|
||||
stack_t uc_stack;
|
||||
mcontext_t uc_mcontext;
|
||||
kernel_sigmask_t uc_sigmask;
|
||||
// Other fields are not used by Google Breakpad. Don't define them.
|
||||
} ucontext_t;
|
||||
|
||||
#elif defined(__x86_64__)
|
||||
enum {
|
||||
REG_R8 = 0,
|
||||
REG_R9,
|
||||
REG_R10,
|
||||
REG_R11,
|
||||
REG_R12,
|
||||
REG_R13,
|
||||
REG_R14,
|
||||
REG_R15,
|
||||
REG_RDI,
|
||||
REG_RSI,
|
||||
REG_RBP,
|
||||
REG_RBX,
|
||||
REG_RDX,
|
||||
REG_RAX,
|
||||
REG_RCX,
|
||||
REG_RSP,
|
||||
REG_RIP,
|
||||
REG_EFL,
|
||||
REG_CSGSFS,
|
||||
REG_ERR,
|
||||
REG_TRAPNO,
|
||||
REG_OLDMASK,
|
||||
REG_CR2,
|
||||
NGREG
|
||||
};
|
||||
|
||||
// This struct is essentially the same as _fpstate in asm/sigcontext.h
|
||||
// except that the individual field names are chosen here to match the
|
||||
// ones used in breakpad for other x86_64 platforms.
|
||||
struct _libc_fpstate {
|
||||
/* 64-bit FXSAVE format. */
|
||||
uint16_t cwd;
|
||||
uint16_t swd;
|
||||
uint16_t ftw;
|
||||
uint16_t fop;
|
||||
uint64_t rip;
|
||||
uint64_t rdp;
|
||||
uint32_t mxcsr;
|
||||
uint32_t mxcr_mask;
|
||||
uint32_t _st[32]; // 128 bytes for the ST/MM registers 0-7
|
||||
uint32_t _xmm[64]; // 256 bytes for the XMM registers 0-7
|
||||
uint32_t padding[24]; // 96 bytes
|
||||
};
|
||||
|
||||
typedef long greg_t;
|
||||
typedef greg_t gregset_t[NGREG];
|
||||
|
||||
typedef struct _libc_fpstate* fpregset_t;
|
||||
|
||||
typedef struct {
|
||||
gregset_t gregs;
|
||||
fpregset_t fpregs;
|
||||
uint64_t __reserved1[8];
|
||||
} mcontext_t;
|
||||
|
||||
typedef struct ucontext {
|
||||
unsigned long uc_flags;
|
||||
struct ucontext* uc_link;
|
||||
stack_t uc_stack;
|
||||
mcontext_t uc_mcontext;
|
||||
sigset_t uc_sigmask;
|
||||
uint64_t __padding[18];
|
||||
_libc_fpstate __fpregs_mem;
|
||||
} ucontext_t;
|
||||
|
||||
#else
|
||||
# error "Unsupported Android CPU ABI!"
|
||||
#endif
|
||||
|
||||
#endif // __BIONIC_HAVE_UCONTEXT_T
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_UCONTEXT_H
|
|
@ -30,200 +30,17 @@
|
|||
#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
|
||||
#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
|
||||
|
||||
#include_next <sys/user.h>
|
||||
|
||||
// This struct is defined under a different name in the Android NDK.
|
||||
#ifdef __i386__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
// These types are used with ptrace(), more specifically with
|
||||
// PTRACE_GETREGS, PTRACE_GETFPREGS and PTRACE_GETVFPREGS respectively.
|
||||
//
|
||||
// They are also defined, sometimes with different names, in <asm/user.h>
|
||||
//
|
||||
|
||||
#if defined(__arm__)
|
||||
|
||||
#define _ARM_USER_H 1 // Prevent <asm/user.h> conflicts
|
||||
|
||||
// Note: on ARM, GLibc uses user_regs instead of user_regs_struct.
|
||||
struct user_regs {
|
||||
// Note: Entries 0-15 match r0..r15
|
||||
// Entry 16 is used to store the CPSR register.
|
||||
// Entry 17 is used to store the "orig_r0" value.
|
||||
unsigned long int uregs[18];
|
||||
};
|
||||
|
||||
// Same here: user_fpregs instead of user_fpregs_struct.
|
||||
struct user_fpregs {
|
||||
struct fp_reg {
|
||||
unsigned int sign1:1;
|
||||
unsigned int unused:15;
|
||||
unsigned int sign2:1;
|
||||
unsigned int exponent:14;
|
||||
unsigned int j:1;
|
||||
unsigned int mantissa1:31;
|
||||
unsigned int mantissa0:32;
|
||||
} fpregs[8];
|
||||
unsigned int fpsr:32;
|
||||
unsigned int fpcr:32;
|
||||
unsigned char ftype[8];
|
||||
unsigned int init_flag;
|
||||
};
|
||||
|
||||
// GLibc doesn't define this one in <sys/user.h> though.
|
||||
struct user_vfpregs {
|
||||
unsigned long long fpregs[32];
|
||||
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
|
||||
|
||||
// GLibc-compatible definitions
|
||||
struct user_regs_struct {
|
||||
long ebx, ecx, edx, esi, edi, ebp, eax;
|
||||
long xds, xes, xfs, xgs, orig_eax;
|
||||
long eip, xcs, eflags, esp, xss;
|
||||
};
|
||||
|
||||
struct user_fpregs_struct {
|
||||
long cwd, swd, twd, fip, fcs, foo, fos;
|
||||
long st_space[20];
|
||||
};
|
||||
|
||||
struct user_fpxregs_struct {
|
||||
unsigned short cwd, swd, twd, fop;
|
||||
long fip, fcs, foo, fos, mxcsr, reserved;
|
||||
long st_space[32];
|
||||
long xmm_space[32];
|
||||
long padding[56];
|
||||
};
|
||||
|
||||
struct user {
|
||||
struct user_regs_struct regs;
|
||||
int u_fpvalid;
|
||||
struct user_fpregs_struct i387;
|
||||
unsigned long u_tsize;
|
||||
unsigned long u_dsize;
|
||||
unsigned long u_ssize;
|
||||
unsigned long start_code;
|
||||
unsigned long start_stack;
|
||||
long signal;
|
||||
int reserved;
|
||||
struct user_regs_struct* u_ar0;
|
||||
struct user_fpregs_struct* u_fpstate;
|
||||
unsigned long magic;
|
||||
char u_comm [32];
|
||||
int u_debugreg [8];
|
||||
};
|
||||
|
||||
|
||||
#elif defined(__mips__)
|
||||
|
||||
#define _ASM_USER_H 1 // Prevent <asm/user.h> conflicts
|
||||
|
||||
#define EF_REG0 6
|
||||
#define EF_REG1 7
|
||||
#define EF_REG2 8
|
||||
#define EF_REG3 9
|
||||
#define EF_REG4 10
|
||||
#define EF_REG5 11
|
||||
#define EF_REG6 12
|
||||
#define EF_REG7 13
|
||||
#define EF_REG8 14
|
||||
#define EF_REG9 15
|
||||
#define EF_REG10 16
|
||||
#define EF_REG11 17
|
||||
#define EF_REG12 18
|
||||
#define EF_REG13 19
|
||||
#define EF_REG14 20
|
||||
#define EF_REG15 21
|
||||
#define EF_REG16 22
|
||||
#define EF_REG17 23
|
||||
#define EF_REG18 24
|
||||
#define EF_REG19 25
|
||||
#define EF_REG20 26
|
||||
#define EF_REG21 27
|
||||
#define EF_REG22 28
|
||||
#define EF_REG23 29
|
||||
#define EF_REG24 30
|
||||
#define EF_REG25 31
|
||||
|
||||
/*
|
||||
* k0/k1 unsaved
|
||||
*/
|
||||
#define EF_REG26 32
|
||||
#define EF_REG27 33
|
||||
|
||||
#define EF_REG28 34
|
||||
#define EF_REG29 35
|
||||
#define EF_REG30 36
|
||||
#define EF_REG31 37
|
||||
|
||||
/*
|
||||
* Saved special registers
|
||||
*/
|
||||
#define EF_LO 38
|
||||
#define EF_HI 39
|
||||
#define EF_CP0_EPC 40
|
||||
#define EF_CP0_BADVADDR 41
|
||||
#define EF_CP0_STATUS 42
|
||||
#define EF_CP0_CAUSE 43
|
||||
|
||||
struct user_regs_struct {
|
||||
unsigned long long regs[32];
|
||||
unsigned long long lo;
|
||||
unsigned long long hi;
|
||||
unsigned long long epc;
|
||||
unsigned long long badvaddr;
|
||||
unsigned long long status;
|
||||
unsigned long long cause;
|
||||
};
|
||||
|
||||
struct user_fpregs_struct {
|
||||
unsigned long long regs[32];
|
||||
unsigned int fpcsr;
|
||||
unsigned int fir;
|
||||
};
|
||||
|
||||
#elif defined(__x86_64__)
|
||||
|
||||
// Bionic's user_fpregs_struct calls the tag word twd instead of ftw. To avoid
|
||||
// changing lots of Bionic, use an ugly macro renaming trick with
|
||||
// #include_next.
|
||||
// TODO(rmcilroy): Remove when NDK headers are fixed.
|
||||
#define user_fpregs_struct __bionic_user_fpregs_struct
|
||||
#include_next <sys/user.h>
|
||||
#undef user_fpregs_struct
|
||||
|
||||
// This struct is the same as user_fpregs_struct in Bionic's sys/user.h
|
||||
// except that the struct name and individual field names are chosen here
|
||||
// to match the ones used in breakpad for other x86_64 platforms.
|
||||
struct user_fpregs_struct {
|
||||
__u16 cwd;
|
||||
__u16 swd;
|
||||
__u16 ftw;
|
||||
__u16 fop;
|
||||
__u64 rip;
|
||||
__u64 rdp;
|
||||
__u32 mxcsr;
|
||||
__u32 mxcr_mask;
|
||||
__u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
|
||||
__u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
|
||||
__u32 padding[24];
|
||||
};
|
||||
|
||||
#else
|
||||
# error "Unsupported Android CPU ABI"
|
||||
#endif
|
||||
|
||||
typedef struct user_fxsr_struct user_fpxregs_struct;
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
#endif // __i386__
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
'android/include/stab.h',
|
||||
'android/include/sys/procfs.h',
|
||||
'android/include/sys/signal.h',
|
||||
'android/include/sys/ucontext.h',
|
||||
'android/include/sys/user.h',
|
||||
'android/include/ucontext.h',
|
||||
'android/testing/include/wchar.h',
|
||||
|
|
Loading…
Reference in a new issue