Improve Android support
This patch remove many Android-specific #ifdefs from the Breakpad source code. This is achieved by providing "fixed-up" platform headers (e.g. <signal.h> or <sys/user,h>), in the new directory src/common/android/include/, which masks differences between the NDK and GLibc headers. The old "android_link.h" and "android_ucontext.h" are moved and renamed. This also requires putting this directory as the first include path during Android-hosted builds, hence the modification of Makefile.am and configure.ac Review URL: https://breakpad.appspot.com/434002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1017 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
d270dcfa18
commit
62d486be7c
21 changed files with 735 additions and 101 deletions
|
@ -32,6 +32,10 @@
|
|||
|
||||
# This allows #includes to be relative to src/
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src
|
||||
if ANDROID_HOST
|
||||
# This allows using fixed NDK headers when building for Android.
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/src/common/android/include
|
||||
endif
|
||||
|
||||
if GCC
|
||||
# These are good warnings to be treated as errors
|
||||
|
|
28
Makefile.in
28
Makefile.in
|
@ -66,27 +66,29 @@ PRE_UNINSTALL = :
|
|||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
# This allows using fixed NDK headers when building for Android.
|
||||
@ANDROID_HOST_TRUE@am__append_1 = -I$(top_srcdir)/src/common/android/include
|
||||
bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3)
|
||||
check_PROGRAMS = $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
|
||||
$(am__EXEEXT_7)
|
||||
@DISABLE_PROCESSOR_FALSE@am__append_1 = src/libbreakpad.a
|
||||
@DISABLE_PROCESSOR_FALSE@am__append_2 = src/third_party/libdisasm/libdisasm.a
|
||||
@LINUX_HOST_TRUE@am__append_3 = src/client/linux/libbreakpad_client.a
|
||||
@DISABLE_PROCESSOR_FALSE@am__append_4 = \
|
||||
@DISABLE_PROCESSOR_FALSE@am__append_2 = src/libbreakpad.a
|
||||
@DISABLE_PROCESSOR_FALSE@am__append_3 = src/third_party/libdisasm/libdisasm.a
|
||||
@LINUX_HOST_TRUE@am__append_4 = src/client/linux/libbreakpad_client.a
|
||||
@DISABLE_PROCESSOR_FALSE@am__append_5 = \
|
||||
@DISABLE_PROCESSOR_FALSE@ src/processor/minidump_dump \
|
||||
@DISABLE_PROCESSOR_FALSE@ src/processor/minidump_stackwalk
|
||||
|
||||
@LINUX_HOST_TRUE@am__append_5 = \
|
||||
@LINUX_HOST_TRUE@am__append_6 = \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/linux_dumper_unittest_helper
|
||||
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__append_6 = \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__append_7 = \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/core2md/core2md \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/dump_syms/dump_syms \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/md2core/minidump-2-core \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/symupload/minidump_upload \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/symupload/sym_upload
|
||||
|
||||
@DISABLE_PROCESSOR_FALSE@am__append_7 = \
|
||||
@DISABLE_PROCESSOR_FALSE@am__append_8 = \
|
||||
@DISABLE_PROCESSOR_FALSE@ src/common/test_assembler_unittest \
|
||||
@DISABLE_PROCESSOR_FALSE@ src/processor/address_map_unittest \
|
||||
@DISABLE_PROCESSOR_FALSE@ src/processor/binarystream_unittest \
|
||||
|
@ -111,14 +113,14 @@ check_PROGRAMS = $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
|
|||
@DISABLE_PROCESSOR_FALSE@ src/processor/stackwalker_x86_unittest \
|
||||
@DISABLE_PROCESSOR_FALSE@ src/processor/synth_minidump_unittest
|
||||
|
||||
@LINUX_HOST_TRUE@am__append_8 = \
|
||||
@LINUX_HOST_TRUE@am__append_9 = \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/linux_client_unittest
|
||||
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__append_9 = \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__append_10 = \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/common/dumper_unittest \
|
||||
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/md2core/minidump_2_core_unittest
|
||||
|
||||
@DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@am__append_10 = \
|
||||
@DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@am__append_11 = \
|
||||
@DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@ src/processor/stackwalker_selftest
|
||||
|
||||
noinst_PROGRAMS =
|
||||
|
@ -1215,7 +1217,7 @@ top_builddir = @top_builddir@
|
|||
top_srcdir = @top_srcdir@
|
||||
|
||||
# This allows #includes to be relative to src/
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src $(am__append_1)
|
||||
|
||||
# These are good warnings to be treated as errors
|
||||
@GCC_TRUE@AM_CXXFLAGS = \
|
||||
|
@ -1236,8 +1238,8 @@ dist_doc_DATA = \
|
|||
NEWS \
|
||||
README
|
||||
|
||||
noinst_LIBRARIES = $(am__append_2)
|
||||
lib_LIBRARIES = $(am__append_1) $(am__append_3)
|
||||
noinst_LIBRARIES = $(am__append_3)
|
||||
lib_LIBRARIES = $(am__append_2) $(am__append_4)
|
||||
@LINUX_HOST_TRUE@src_client_linux_libbreakpad_client_a_SOURCES = \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/crash_generation/crash_generation_client.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/handler/exception_handler.cc \
|
||||
|
|
|
@ -92,7 +92,9 @@ LOCAL_SRC_FILES := \
|
|||
src/common/linux/memory_mapped_file.cc \
|
||||
src/common/linux/safe_readlink.cc
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/src
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/src/common/android/include \
|
||||
$(LOCAL_PATH)/src
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
|
||||
LOCAL_EXPORT_LDLIBS := -llog
|
||||
|
||||
|
|
27
configure
vendored
27
configure
vendored
|
@ -604,6 +604,8 @@ DISABLE_TOOLS_FALSE
|
|||
DISABLE_TOOLS_TRUE
|
||||
DISABLE_PROCESSOR_FALSE
|
||||
DISABLE_PROCESSOR_TRUE
|
||||
ANDROID_HOST_FALSE
|
||||
ANDROID_HOST_TRUE
|
||||
LINUX_HOST_FALSE
|
||||
LINUX_HOST_TRUE
|
||||
PTHREAD_CFLAGS
|
||||
|
@ -5239,9 +5241,9 @@ done
|
|||
|
||||
# Only build Linux client libs when compiling for Linux
|
||||
case $host in
|
||||
*-*-linux* | *-android* )
|
||||
LINUX_HOST=true
|
||||
;;
|
||||
*-*-linux* | *-android* )
|
||||
LINUX_HOST=true
|
||||
;;
|
||||
esac
|
||||
if test x$LINUX_HOST = xtrue; then
|
||||
LINUX_HOST_TRUE=
|
||||
|
@ -5252,6 +5254,21 @@ else
|
|||
fi
|
||||
|
||||
|
||||
# Only use Android support headers when compiling for Android
|
||||
case $host in
|
||||
*-android*)
|
||||
ANDROID_HOST=true
|
||||
;;
|
||||
esac
|
||||
if test x$ANDROID_HOST = xtrue; then
|
||||
ANDROID_HOST_TRUE=
|
||||
ANDROID_HOST_FALSE='#'
|
||||
else
|
||||
ANDROID_HOST_TRUE='#'
|
||||
ANDROID_HOST_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-m32 was given.
|
||||
if test "${enable_m32+set}" = set; then :
|
||||
enableval=$enable_m32; case "${enableval}" in
|
||||
|
@ -5481,6 +5498,10 @@ if test -z "${LINUX_HOST_TRUE}" && test -z "${LINUX_HOST_FALSE}"; then
|
|||
as_fn_error "conditional \"LINUX_HOST\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${ANDROID_HOST_TRUE}" && test -z "${ANDROID_HOST_FALSE}"; then
|
||||
as_fn_error "conditional \"ANDROID_HOST\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${DISABLE_PROCESSOR_TRUE}" && test -z "${DISABLE_PROCESSOR_FALSE}"; then
|
||||
as_fn_error "conditional \"DISABLE_PROCESSOR\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
|
|
14
configure.ac
14
configure.ac
|
@ -54,12 +54,20 @@ AC_CHECK_HEADERS([a.out.h])
|
|||
|
||||
# Only build Linux client libs when compiling for Linux
|
||||
case $host in
|
||||
*-*-linux* | *-android* )
|
||||
LINUX_HOST=true
|
||||
;;
|
||||
*-*-linux* | *-android* )
|
||||
LINUX_HOST=true
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL(LINUX_HOST, test x$LINUX_HOST = xtrue)
|
||||
|
||||
# Only use Android support headers when compiling for Android
|
||||
case $host in
|
||||
*-android*)
|
||||
ANDROID_HOST=true
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL(ANDROID_HOST, test x$ANDROID_HOST = xtrue)
|
||||
|
||||
AC_ARG_ENABLE(m32,
|
||||
AS_HELP_STRING([--enable-m32],
|
||||
[Compile/build with -m32]
|
||||
|
|
|
@ -77,12 +77,10 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(__ANDROID__)
|
||||
#include <sys/signal.h>
|
||||
#include <sys/ucontext.h>
|
||||
#include <sys/user.h>
|
||||
#include <ucontext.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
|
|
@ -37,10 +37,8 @@
|
|||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ucontext.h>
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include "client/linux/android_ucontext.h"
|
||||
#endif
|
||||
#include "client/linux/crash_generation/crash_generation_client.h"
|
||||
#include "client/linux/handler/minidump_descriptor.h"
|
||||
#include "client/linux/minidump_writer/minidump_writer.h"
|
||||
|
|
|
@ -42,9 +42,7 @@
|
|||
#include <linux/limits.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#if !defined(__ANDROID__)
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
|
||||
#include "common/memory.h"
|
||||
#include "google_breakpad/common/minidump_format.h"
|
||||
|
@ -57,23 +55,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__)
|
||||
#if !defined(__ANDROID__)
|
||||
typedef Elf32_auxv_t elf_aux_entry;
|
||||
#else
|
||||
// Android is missing this structure definition
|
||||
typedef struct
|
||||
{
|
||||
uint32_t a_type; /* Entry type */
|
||||
union
|
||||
{
|
||||
uint32_t a_val; /* Integer value */
|
||||
} a_un;
|
||||
} elf_aux_entry;
|
||||
|
||||
#if !defined(AT_SYSINFO_EHDR)
|
||||
#define AT_SYSINFO_EHDR 33
|
||||
#endif
|
||||
#endif // __ANDROID__
|
||||
#elif defined(__x86_64)
|
||||
typedef Elf64_auxv_t elf_aux_entry;
|
||||
#endif
|
||||
|
@ -104,12 +86,8 @@ struct ThreadInfo {
|
|||
|
||||
#elif defined(__ARM_EABI__)
|
||||
// Mimicking how strace does this(see syscall.c, search for GETREGS)
|
||||
#if defined(__ANDROID__)
|
||||
struct pt_regs regs;
|
||||
#else
|
||||
struct user_regs regs;
|
||||
struct user_fpregs fpregs;
|
||||
#endif // __ANDROID__
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -186,11 +186,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#if !defined(__ANDROID__)
|
||||
if (sys_ptrace(PTRACE_GETFPREGS, tid, NULL, &info->fpregs) == -1) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__i386)
|
||||
if (sys_ptrace(PTRACE_GETFPXREGS, tid, NULL, &info->fpxregs) == -1)
|
||||
|
|
|
@ -50,17 +50,13 @@
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#if !defined(__ANDROID__)
|
||||
#include <link.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#if defined(__ANDROID__)
|
||||
#include <sys/system_properties.h>
|
||||
#endif
|
||||
#if !defined(__ANDROID__)
|
||||
#include <sys/ucontext.h>
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -69,10 +65,6 @@
|
|||
#include "client/minidump_file_writer.h"
|
||||
#include "google_breakpad/common/minidump_format.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include "client/linux/android_link.h"
|
||||
#include "client/linux/android_ucontext.h"
|
||||
#endif
|
||||
#include "client/linux/handler/exception_handler.h"
|
||||
#include "client/linux/minidump_writer/line_reader.h"
|
||||
#include "client/linux/minidump_writer/linux_dumper.h"
|
||||
|
|
159
src/common/android/include/elf.h
Normal file
159
src/common/android/include/elf.h
Normal file
|
@ -0,0 +1,159 @@
|
|||
// 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 <stdint.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
// The Android <elf.h> 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 <elf.h>
|
||||
|
||||
#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
|
67
src/common/android/include/link.h
Normal file
67
src/common/android/include/link.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
// 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 <link.h>. Provide custom version here */
|
||||
#include <elf.h>
|
||||
|
||||
#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 */
|
100
src/common/android/include/stab.h
Normal file
100
src/common/android/include/stab.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
// 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 <sys/cdefs.h>
|
||||
|
||||
#ifdef __BIONIC_HAVE_STAB_H
|
||||
#include <stab.h>
|
||||
#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
|
113
src/common/android/include/sys/procfs.h
Normal file
113
src/common/android/include/sys/procfs.h
Normal file
|
@ -0,0 +1,113 @@
|
|||
// 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 <sys/procfs.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/user.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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
|
35
src/common/android/include/sys/signal.h
Normal file
35
src/common/android/include/sys/signal.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
// 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 <signal.h>
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_SIGNAL_H
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2010, Google Inc.
|
||||
// Copyright (c) 2012, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -27,22 +27,13 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// The Android NDK doesn't have link.h. Fortunately, the only thing
|
||||
// that Breakpad uses from it is the ElfW macro, so define it here.
|
||||
#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H
|
||||
#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_CLIENT_LINUX_ANDROID_LINK_H_
|
||||
#define GOOGLE_BREAKPAD_CLIENT_LINUX_ANDROID_LINK_H_
|
||||
#include_next <sys/stat.h>
|
||||
|
||||
// TODO(zhenghao): exec_elf.h conflicts with linux/elf.h.
|
||||
// But we still need ELFSIZE.
|
||||
//#include <sys/exec_elf.h>
|
||||
#include <machine/exec.h>
|
||||
#define ELFSIZE ARCH_ELFSIZE
|
||||
|
||||
#ifndef ElfW
|
||||
#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
|
||||
#ifndef S_IRWXU
|
||||
#define S_IRWXU 00700
|
||||
#endif
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_CLIENT_LINUX_ANDROID_LINK_H_
|
||||
#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2009, Google Inc.
|
||||
// Copyright (c) 2012, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -27,22 +27,23 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Only recent versions of Android's C library correctly define the
|
||||
// required types for ucontext_t handling. This header provides a
|
||||
// custom declarations that will work when Google Breakpad is built
|
||||
// against any version of the NDK or platform headers, and work on
|
||||
// any version of the system.
|
||||
//
|
||||
// See http://code.google.com/p/android/issues/detail?id=34784
|
||||
//
|
||||
#ifndef GOOGLE_BREAKPAD_CLIENT_LINUX_ANDROID_UCONTEXT_H_
|
||||
#define GOOGLE_BREAKPAD_CLIENT_LINUX_ANDROID_UCONTEXT_H_
|
||||
#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>
|
||||
#include <stdint.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.
|
||||
|
@ -78,6 +79,8 @@ struct _libc_fpstate {
|
|||
unsigned long status;
|
||||
};
|
||||
|
||||
typedef uint32_t greg_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t gregs[19];
|
||||
struct _libc_fpstate* fpregs;
|
||||
|
@ -105,10 +108,6 @@ enum {
|
|||
REG_EFL,
|
||||
REG_UESP,
|
||||
REG_SS,
|
||||
REG_ES,
|
||||
REG_ES,
|
||||
REG_ES,
|
||||
REG_ES,
|
||||
};
|
||||
|
||||
typedef struct ucontext {
|
||||
|
@ -155,6 +154,10 @@ typedef struct ucontext {
|
|||
# error "Unsupported Android CPU ABI!"
|
||||
#endif
|
||||
|
||||
#endif // !__BIONIC_HAVE_UCONTEXT_T
|
||||
#endif // __BIONIC_HAVE_UCONTEXT_T
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_CLIENT_LINUX_ANDROID_UCONTEXT_H_
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_UCONTEXT_H
|
134
src/common/android/include/sys/user.h
Normal file
134
src/common/android/include/sys/user.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
// 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 <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(__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__)
|
||||
|
||||
// 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
|
41
src/common/android/include/ucontext.h
Normal file
41
src/common/android/include/ucontext.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
// 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 <sys/ucontext.h>
|
||||
|
||||
// TODO: Provide a portable implementation of getcontext() then
|
||||
// update ExceptionHandler::WriteMinidump() in
|
||||
// src/client/linux/handler/exception_handler.cc to use it.
|
||||
//
|
||||
// extern int getcontext(ucontext_t* ucp);
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_UCONTEXT_H
|
|
@ -34,15 +34,10 @@
|
|||
#define COMMON_LINUX_ELF_CORE_DUMP_H_
|
||||
|
||||
#include <elf.h>
|
||||
#if !defined(__ANDROID__)
|
||||
#include <link.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
||||
#include "common/memory_range.h"
|
||||
#if defined(__ANDROID__)
|
||||
#include "common/linux/android_link.h"
|
||||
#endif
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
|
|
|
@ -33,13 +33,8 @@
|
|||
#ifndef COMMON_LINUX_ELFUTILS_H__
|
||||
#define COMMON_LINUX_ELFUTILS_H__
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <linux/elf.h>
|
||||
#include "client/linux/android_link.h"
|
||||
#else
|
||||
#include <elf.h>
|
||||
#include <link.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
namespace google_breakpad {
|
||||
|
|
Loading…
Reference in a new issue