From 5693604fd0f5c03c29138a3cc71455260451d258 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 15 Jun 2016 10:59:49 +0100 Subject: [PATCH] Bug 1276927: Fix breakpad to build on B2G, r=mshal This patch unifies the include search directories for the breakpad on B2G and Android, and protects breakpad-internal workarounds against multiple definition. As a side-effect of the patch set, no more Gonk-specific headers from 'gonk-include' are requried to build toolkit/ or xpcom/. The related artifacts are removed by this patch. MozReview-Commit-ID: E94I2rspDtJ --- toolkit/crashreporter/gonk-include/elf.h | 159 ---------------- toolkit/crashreporter/gonk-include/link.h | 67 ------- toolkit/crashreporter/gonk-include/stab.h | 100 ---------- .../crashreporter/gonk-include/sys/procfs.h | 113 ----------- .../crashreporter/gonk-include/sys/signal.h | 35 ---- toolkit/crashreporter/gonk-include/sys/stat.h | 39 ---- .../crashreporter/gonk-include/sys/ucontext.h | 175 ------------------ toolkit/crashreporter/gonk-include/sys/user.h | 134 -------------- toolkit/crashreporter/gonk-include/ucontext.h | 55 ------ .../src/client/linux/moz.build | 11 +- .../src/common/android/include/link.h | 2 + .../src/common/linux/moz.build | 11 +- .../google-breakpad/src/common/moz.build | 12 +- toolkit/crashreporter/moz.build | 11 +- tools/profiler/moz.build | 12 +- xpcom/threads/moz.build | 7 - 16 files changed, 16 insertions(+), 927 deletions(-) delete mode 100644 toolkit/crashreporter/gonk-include/elf.h delete mode 100644 toolkit/crashreporter/gonk-include/link.h delete mode 100644 toolkit/crashreporter/gonk-include/stab.h delete mode 100644 toolkit/crashreporter/gonk-include/sys/procfs.h delete mode 100644 toolkit/crashreporter/gonk-include/sys/signal.h delete mode 100644 toolkit/crashreporter/gonk-include/sys/stat.h delete mode 100644 toolkit/crashreporter/gonk-include/sys/ucontext.h delete mode 100644 toolkit/crashreporter/gonk-include/sys/user.h delete mode 100644 toolkit/crashreporter/gonk-include/ucontext.h diff --git a/toolkit/crashreporter/gonk-include/elf.h b/toolkit/crashreporter/gonk-include/elf.h deleted file mode 100644 index debe30be67af5..0000000000000 --- a/toolkit/crashreporter/gonk-include/elf.h +++ /dev/null @@ -1,159 +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_ELF_H -#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// The Android provides BSD-based definitions for the ElfXX_Nhdr -// types -// always source-compatible with the GLibc/kernel ones. To overcome this -// issue without modifying a lot of code in Breakpad, use an ugly macro -// renaming trick with #include_next - -// Avoid conflict with BSD-based definition of ElfXX_Nhdr. -// Unfortunately, their field member names do not use a 'n_' prefix. -#define Elf32_Nhdr __bsd_Elf32_Nhdr -#define Elf64_Nhdr __bsd_Elf64_Nhdr - -// In case they are defined by the NDK version -#define Elf32_auxv_t __bionic_Elf32_auxv_t -#define Elf64_auxv_t __bionic_Elf64_auxv_t - -#define Elf32_Dyn __bionic_Elf32_Dyn -#define Elf64_Dyn __bionic_Elf64_Dyn - -#include_next - -#undef Elf32_Nhdr -#undef Elf64_Nhdr - -typedef struct { - Elf32_Word n_namesz; - Elf32_Word n_descsz; - Elf32_Word n_type; -} Elf32_Nhdr; - -typedef struct { - Elf64_Word n_namesz; - Elf64_Word n_descsz; - Elf64_Word n_type; -} Elf64_Nhdr; - -#undef Elf32_auxv_t -#undef Elf64_auxv_t - -typedef struct { - uint32_t a_type; - union { - uint32_t a_val; - } a_un; -} Elf32_auxv_t; - -typedef struct { - uint64_t a_type; - union { - uint64_t a_val; - } a_un; -} Elf64_auxv_t; - -#undef Elf32_Dyn -#undef Elf64_Dyn - -typedef struct { - Elf32_Sword d_tag; - union { - Elf32_Word d_val; - Elf32_Addr d_ptr; - } d_un; -} Elf32_Dyn; - -typedef struct { - Elf64_Sxword d_tag; - union { - Elf64_Xword d_val; - Elf64_Addr d_ptr; - } d_un; -} Elf64_Dyn; - - -// __WORDSIZE is GLibc-specific and used by Google Breakpad on Linux. -// All Android platforms are 32-bit for now. -#ifndef __WORDSIZE -#define __WORDSIZE 32 -#endif - -// The Android headers don't always define this constant. -#ifndef EM_X86_64 -#define EM_X86_64 62 -#endif - -#ifndef EM_PPC64 -#define EM_PPC64 21 -#endif - -#ifndef EM_S390 -#define EM_S390 22 -#endif - -#if !defined(AT_SYSINFO_EHDR) -#define AT_SYSINFO_EHDR 33 -#endif - -#if !defined(NT_PRSTATUS) -#define NT_PRSTATUS 1 -#endif - -#if !defined(NT_PRPSINFO) -#define NT_PRPSINFO 3 -#endif - -#if !defined(NT_AUXV) -#define NT_AUXV 6 -#endif - -#if !defined(NT_PRXFPREG) -#define NT_PRXFPREG 0x46e62b7f -#endif - -#if !defined(NT_FPREGSET) -#define NT_FPREGSET 2 -#endif - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H diff --git a/toolkit/crashreporter/gonk-include/link.h b/toolkit/crashreporter/gonk-include/link.h deleted file mode 100644 index 6f3c182805eb1..0000000000000 --- a/toolkit/crashreporter/gonk-include/link.h +++ /dev/null @@ -1,67 +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_ANDROID_INCLUDE_LINK_H -#define GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H - -/* Android doesn't provide . Provide custom version here */ -#include - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -#define ElfW(type) _ElfW (Elf, ELFSIZE, type) -#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) -#define _ElfW_1(e,w,t) e##w##t - -struct r_debug { - int r_version; - struct link_map* r_map; - ElfW(Addr) r_brk; - enum { - RT_CONSISTENT, - RT_ADD, - RT_DELETE } r_state; - ElfW(Addr) r_ldbase; -}; - -struct link_map { - ElfW(Addr) l_addr; - char* l_name; - ElfW(Dyn)* l_ld; - struct link_map* l_next; - struct link_map* l_prev; -}; - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif /* GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H */ diff --git a/toolkit/crashreporter/gonk-include/stab.h b/toolkit/crashreporter/gonk-include/stab.h deleted file mode 100644 index cd92902151a0f..0000000000000 --- a/toolkit/crashreporter/gonk-include/stab.h +++ /dev/null @@ -1,100 +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_STAB_H -#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_STAB_H - -#include - -#ifdef __BIONIC_HAVE_STAB_H -#include -#else - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -#define _STAB_CODE_LIST \ - _STAB_CODE_DEF(UNDF,0x00) \ - _STAB_CODE_DEF(GSYM,0x20) \ - _STAB_CODE_DEF(FNAME,0x22) \ - _STAB_CODE_DEF(FUN,0x24) \ - _STAB_CODE_DEF(STSYM,0x26) \ - _STAB_CODE_DEF(LCSYM,0x28) \ - _STAB_CODE_DEF(MAIN,0x2a) \ - _STAB_CODE_DEF(PC,0x30) \ - _STAB_CODE_DEF(NSYMS,0x32) \ - _STAB_CODE_DEF(NOMAP,0x34) \ - _STAB_CODE_DEF(OBJ,0x38) \ - _STAB_CODE_DEF(OPT,0x3c) \ - _STAB_CODE_DEF(RSYM,0x40) \ - _STAB_CODE_DEF(M2C,0x42) \ - _STAB_CODE_DEF(SLINE,0x44) \ - _STAB_CODE_DEF(DSLINE,0x46) \ - _STAB_CODE_DEF(BSLINE,0x48) \ - _STAB_CODE_DEF(BROWS,0x48) \ - _STAB_CODE_DEF(DEFD,0x4a) \ - _STAB_CODE_DEF(EHDECL,0x50) \ - _STAB_CODE_DEF(MOD2,0x50) \ - _STAB_CODE_DEF(CATCH,0x54) \ - _STAB_CODE_DEF(SSYM,0x60) \ - _STAB_CODE_DEF(SO,0x64) \ - _STAB_CODE_DEF(LSYM,0x80) \ - _STAB_CODE_DEF(BINCL,0x82) \ - _STAB_CODE_DEF(SOL,0x84) \ - _STAB_CODE_DEF(PSYM,0xa0) \ - _STAB_CODE_DEF(EINCL,0xa2) \ - _STAB_CODE_DEF(ENTRY,0xa4) \ - _STAB_CODE_DEF(LBRAC,0xc0) \ - _STAB_CODE_DEF(EXCL,0xc2) \ - _STAB_CODE_DEF(SCOPE,0xc4) \ - _STAB_CODE_DEF(RBRAC,0xe0) \ - _STAB_CODE_DEF(BCOMM,0xe2) \ - _STAB_CODE_DEF(ECOMM,0xe4) \ - _STAB_CODE_DEF(ECOML,0xe8) \ - _STAB_CODE_DEF(NBTEXT,0xf0) \ - _STAB_CODE_DEF(NBDATA,0xf2) \ - _STAB_CODE_DEF(NBBSS,0xf4) \ - _STAB_CODE_DEF(NBSTS,0xf6) \ - _STAB_CODE_DEF(NBLCS,0xf8) \ - _STAB_CODE_DEF(LENG,0xfe) - -enum __stab_debug_code { -#define _STAB_CODE_DEF(x,y) N_##x = y, -_STAB_CODE_LIST -#undef _STAB_CODE_DEF -}; - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // __BIONIC_HAVE_STAB_H - -#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_STAB_H diff --git a/toolkit/crashreporter/gonk-include/sys/procfs.h b/toolkit/crashreporter/gonk-include/sys/procfs.h deleted file mode 100644 index 9cfdd01c7e2bd..0000000000000 --- a/toolkit/crashreporter/gonk-include/sys/procfs.h +++ /dev/null @@ -1,113 +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_SYS_PROCFS_H -#define GOOGLE_BREAKPAD_COMMON_ANDROID_SYS_PROCFS_H - -#ifdef __BIONIC_HAVE_SYS_PROCFS_H - -#include_next - -#else - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -#ifdef __x86_64__ -typedef unsigned long long elf_greg_t; -#else -typedef unsigned long elf_greg_t; -#endif - -#ifdef __arm__ -#define ELF_NGREG (sizeof(struct user_regs) / sizeof(elf_greg_t)) -#else -#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t)) -#endif - -typedef elf_greg_t elf_gregset_t[ELF_NGREG]; - -struct elf_siginfo { - int si_signo; - int si_code; - int si_errno; -}; - -struct elf_prstatus { - struct elf_siginfo pr_info; - short pr_cursig; - unsigned long pr_sigpend; - unsigned long pr_sighold; - pid_t pr_pid; - pid_t pr_ppid; - pid_t pr_pgrp; - pid_t pd_sid; - struct timeval pr_utime; - struct timeval pr_stime; - struct timeval pr_cutime; - struct timeval pr_cstime; - elf_gregset_t pr_reg; - int pr_fpvalid; -}; - -#define ELF_PRARGSZ 80 - -struct elf_prpsinfo { - char pr_state; - char pr_sname; - char pr_zomb; - char pr_nice; - unsigned long pr_flags; -#ifdef __x86_64__ - unsigned int pr_uid; - unsigned int pr_gid; -#else - unsigned short pr_uid; - unsigned short pr_gid; -#endif - int pr_pid; - int pr_ppid; - int pr_pgrp; - int pr_sid; - char pr_fname[16]; - char pr_psargs[ELF_PRARGSZ]; -}; - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // __BIONIC_HAVE_SYS_PROCFS_H - -#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_SYS_PROCFS_H diff --git a/toolkit/crashreporter/gonk-include/sys/signal.h b/toolkit/crashreporter/gonk-include/sys/signal.h deleted file mode 100644 index 20c81e93796e1..0000000000000 --- a/toolkit/crashreporter/gonk-include/sys/signal.h +++ /dev/null @@ -1,35 +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_SIGNAL_H -#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_SIGNAL_H - -#include - -#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_SIGNAL_H diff --git a/toolkit/crashreporter/gonk-include/sys/stat.h b/toolkit/crashreporter/gonk-include/sys/stat.h deleted file mode 100644 index 93ebd0800b0b6..0000000000000 --- a/toolkit/crashreporter/gonk-include/sys/stat.h +++ /dev/null @@ -1,39 +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_STAT_H -#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H - -#include_next - -#ifndef S_IRWXU -#define S_IRWXU 00700 -#endif - -#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H diff --git a/toolkit/crashreporter/gonk-include/sys/ucontext.h b/toolkit/crashreporter/gonk-include/sys/ucontext.h deleted file mode 100644 index 4a4e77c18689d..0000000000000 --- a/toolkit/crashreporter/gonk-include/sys/ucontext.h +++ /dev/null @@ -1,175 +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 -#include - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -#ifndef __BIONIC_HAVE_UCONTEXT_T - -// Ensure that 'stack_t' is defined. -#include - -// 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 -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(__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__) - -// Not supported by Google Breakpad at this point, but just in case. -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; - -#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 diff --git a/toolkit/crashreporter/gonk-include/sys/user.h b/toolkit/crashreporter/gonk-include/sys/user.h deleted file mode 100644 index d13e5f6eb4732..0000000000000 --- a/toolkit/crashreporter/gonk-include/sys/user.h +++ /dev/null @@ -1,134 +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_USER_H -#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H - -#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 -// - -#if defined(__arm__) - -#define _ARM_USER_H 1 // Prevent 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 though. -struct user_vfpregs { - unsigned long long fpregs[32]; - unsigned long fpscr; -}; - -#elif defined(__i386__) - -#define _I386_USER_H 1 // Prevent 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__) - -// TODO: Provide some useful definitions here, once the rest of Breakpad -// requires them. - -#else -# error "Unsupported Android CPU ABI" -#endif - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H diff --git a/toolkit/crashreporter/gonk-include/ucontext.h b/toolkit/crashreporter/gonk-include/ucontext.h deleted file mode 100644 index cbaba6527bbd7..0000000000000 --- a/toolkit/crashreporter/gonk-include/ucontext.h +++ /dev/null @@ -1,55 +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_UCONTEXT_H -#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_UCONTEXT_H - -#include -#include - -#ifdef __BIONIC_HAVE_UCONTEXT_H -# include_next -#else -# include -#endif // __BIONIC_UCONTEXT_H - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// Provided by src/android/common/breakpad_getcontext.S -int breakpad_getcontext(ucontext_t* ucp); - -#define getcontext(x) breakpad_getcontext(x) - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_UCONTEXT_H diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build b/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build index fe49bb5f78e32..b3f1b79bb5b64 100644 --- a/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build +++ b/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build @@ -19,14 +19,9 @@ UNIFIED_SOURCES += [ ] if CONFIG['OS_TARGET'] == 'Android': - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/gonk-include', - ] - else: - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/google-breakpad/src/common/android/include', - ] + LOCAL_INCLUDES += [ + '/toolkit/crashreporter/google-breakpad/src/common/android/include', + ] # We allow warnings for third-party code that can be updated from upstream. ALLOW_COMPILER_WARNINGS = True diff --git a/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h b/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h index e7ff8e2d8702b..93e42ee90db84 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h +++ b/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h @@ -43,6 +43,7 @@ extern "C" { #endif // __cplusplus +#if ANDROID_VERSION <= 20 struct r_debug { int r_version; struct link_map* r_map; @@ -61,6 +62,7 @@ struct link_map { struct link_map* l_next; struct link_map* l_prev; }; +#endif #ifdef __cplusplus } // extern "C" diff --git a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build index c922b40a06887..eb429029a3529 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build +++ b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build @@ -40,14 +40,9 @@ HOST_CXXFLAGS += [ ] if CONFIG['OS_TARGET'] == 'Android': - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/gonk-include', - ] - else: - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/google-breakpad/src/common/android/include', - ] + LOCAL_INCLUDES += [ + '/toolkit/crashreporter/google-breakpad/src/common/android/include', + ] Library('breakpad_linux_common_s') diff --git a/toolkit/crashreporter/google-breakpad/src/common/moz.build b/toolkit/crashreporter/google-breakpad/src/common/moz.build index c0c0ed7cb09df..592ff70905ccd 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/moz.build +++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build @@ -54,15 +54,9 @@ if CONFIG['OS_TARGET'] == 'Android': SOURCES += [ 'android/breakpad_getcontext.S', ] - - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/gonk-include', - ] - else: - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/google-breakpad/src/common/android/include', - ] + LOCAL_INCLUDES += [ + '/toolkit/crashreporter/google-breakpad/src/common/android/include', + ] Library('breakpad_common_s') diff --git a/toolkit/crashreporter/moz.build b/toolkit/crashreporter/moz.build index 135e185a2ddbd..855cf050abf3a 100644 --- a/toolkit/crashreporter/moz.build +++ b/toolkit/crashreporter/moz.build @@ -87,14 +87,9 @@ if CONFIG['OS_TARGET'] == 'Android': # NDK5 workarounds DEFINES['_STLP_CONST_CONSTRUCTOR_BUG'] = True DEFINES['_STLP_NO_MEMBER_TEMPLATES'] = True - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/gonk-include', - ] - else: - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/google-breakpad/src/common/android/include', - ] + LOCAL_INCLUDES += [ + '/toolkit/crashreporter/google-breakpad/src/common/android/include', + ] if CONFIG['OS_ARCH'] == 'SunOS': # there's no define for this normally diff --git a/tools/profiler/moz.build b/tools/profiler/moz.build index 171986807cb18..4f4e391f03e2a 100644 --- a/tools/profiler/moz.build +++ b/tools/profiler/moz.build @@ -89,21 +89,13 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']: '/ipc/chromium/src', '/mozglue/linker', '/toolkit/crashreporter/google-breakpad/src', + # We need access to Breakpad's getcontext(3) which is suitable for Android + '/toolkit/crashreporter/google-breakpad/src/common/android/include', '/tools/profiler/core/', '/tools/profiler/gecko/', '/xpcom/base', ] - # We need access to Breakpad's getcontext(3) which is suitable for Android - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/gonk-include', - ] - elif CONFIG['OS_TARGET'] == 'Android': - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/google-breakpad/src/common/android/include', - ] - if not CONFIG['MOZ_CRASHREPORTER'] and CONFIG['OS_TARGET'] in ('Android', 'gonk'): SOURCES += ['/toolkit/crashreporter/google-breakpad/src/common/android/breakpad_getcontext.S'] diff --git a/xpcom/threads/moz.build b/xpcom/threads/moz.build index a3bafca637fc9..6b3cf80446a5b 100644 --- a/xpcom/threads/moz.build +++ b/xpcom/threads/moz.build @@ -68,13 +68,6 @@ LOCAL_INCLUDES += [ '/tools/profiler', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - # Gonk's bionic doesn't have ucontext.h - LOCAL_INCLUDES += [ - '/toolkit/crashreporter/gonk-include', - ] - - # BHR disabled for Release builds because of bug 965392. # BHR disabled for debug builds because of bug 979069. # BHR disabled on gonk because of bug 1180533