diff --git a/Makefile.am b/Makefile.am index 31433ecc..fb4d303a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -337,9 +337,15 @@ endif if LINUX_HOST src_client_linux_linux_dumper_unittest_helper_SOURCES = \ src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc -src_client_linux_linux_dumper_unittest_helper_CXXFLAGS=$(PTHREAD_CFLAGS) src_client_linux_linux_dumper_unittest_helper_LDFLAGS=$(PTHREAD_CFLAGS) src_client_linux_linux_dumper_unittest_helper_CC=$(PTHREAD_CC) +if ANDROID_HOST +# On Android PTHREAD_CFLAGS is empty, and adding src/common/android/include +# to the include path is necessary to build this program. +src_client_linux_linux_dumper_unittest_helper_CXXFLAGS=$(AM_CXXFLAGS) +else +src_client_linux_linux_dumper_unittest_helper_CXXFLAGS=$(PTHREAD_CFLAGS) +endif src_client_linux_linux_client_unittest_shlib_SOURCES = \ src/client/linux/handler/exception_handler_unittest.cc \ diff --git a/Makefile.in b/Makefile.in index df537dfd..139c1367 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1585,9 +1585,12 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS) @LINUX_HOST_TRUE@src_client_linux_linux_dumper_unittest_helper_SOURCES = \ @LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc -@LINUX_HOST_TRUE@src_client_linux_linux_dumper_unittest_helper_CXXFLAGS = $(PTHREAD_CFLAGS) @LINUX_HOST_TRUE@src_client_linux_linux_dumper_unittest_helper_LDFLAGS = $(PTHREAD_CFLAGS) @LINUX_HOST_TRUE@src_client_linux_linux_dumper_unittest_helper_CC = $(PTHREAD_CC) +@ANDROID_HOST_FALSE@@LINUX_HOST_TRUE@src_client_linux_linux_dumper_unittest_helper_CXXFLAGS = $(PTHREAD_CFLAGS) +# On Android PTHREAD_CFLAGS is empty, and adding src/common/android/include +# to the include path is necessary to build this program. +@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@src_client_linux_linux_dumper_unittest_helper_CXXFLAGS = $(AM_CXXFLAGS) @LINUX_HOST_TRUE@src_client_linux_linux_client_unittest_shlib_SOURCES = src/client/linux/handler/exception_handler_unittest.cc \ @LINUX_HOST_TRUE@ src/client/linux/minidump_writer/directory_reader_unittest.cc \ @LINUX_HOST_TRUE@ src/client/linux/minidump_writer/cpu_set_unittest.cc \ @@ -3292,9 +3295,6 @@ src/testing/src/src_processor_stackwalker_arm_unittest-gmock-all.$(OBJEXT): \ src/processor/stackwalker_arm_unittest$(EXEEXT): $(src_processor_stackwalker_arm_unittest_OBJECTS) $(src_processor_stackwalker_arm_unittest_DEPENDENCIES) $(EXTRA_src_processor_stackwalker_arm_unittest_DEPENDENCIES) src/processor/$(am__dirstamp) @rm -f src/processor/stackwalker_arm_unittest$(EXEEXT) $(CXXLINK) $(src_processor_stackwalker_arm_unittest_OBJECTS) $(src_processor_stackwalker_arm_unittest_LDADD) $(LIBS) -src/processor/stackwalker_selftest.$(OBJEXT): \ - src/processor/$(am__dirstamp) \ - src/processor/$(DEPDIR)/$(am__dirstamp) src/common/src_processor_stackwalker_mips_unittest-test_assembler.$(OBJEXT): \ src/common/$(am__dirstamp) \ src/common/$(DEPDIR)/$(am__dirstamp) diff --git a/README.ANDROID b/README.ANDROID index 5814db45..386fba1b 100644 --- a/README.ANDROID +++ b/README.ANDROID @@ -5,8 +5,7 @@ This document explains how to use the Google Breakpad client library on Android, and later generate valid stack traces from the minidumps it generates. -This release supports ARM and x86 based Android systems. MIPS is not -currently supported by Breakpad. +This release supports ARM, x86 and MIPS based Android systems. I. Building the client library: =============================== diff --git a/android/google_breakpad/Android.mk b/android/google_breakpad/Android.mk index 7bd44003..52fa5e4b 100644 --- a/android/google_breakpad/Android.mk +++ b/android/google_breakpad/Android.mk @@ -45,11 +45,6 @@ # to select one in your Application.mk # -# Sanity check. We can only build for ARM for now. -ifneq (,$(filter-out armeabi armeabi-v7a x86,$(TARGET_ARCH_ABI))) -$(error Sorry, Google Breakpad only works on Android ARM and x86 for now!) -endif - # The top Google Breakpad directory. # We assume this Android.mk to be under 'android/google_breakpad' @@ -85,7 +80,8 @@ LOCAL_SRC_FILES := \ src/client/minidump_file_writer.cc \ src/common/android/breakpad_getcontext.S \ src/common/convert_UTF.c \ - src/common/md5.cc src/common/string_conversion.cc \ + src/common/md5.cc \ + src/common/string_conversion.cc \ src/common/linux/elfutils.cc \ src/common/linux/file_id.cc \ src/common/linux/guid_creator.cc \ diff --git a/android/run-checks.sh b/android/run-checks.sh index 400f7561..51d2d502 100755 --- a/android/run-checks.sh +++ b/android/run-checks.sh @@ -326,6 +326,9 @@ case $ARCH in x86) GNU_CONFIG=i686-linux-android ;; + mips) + GNU_CONFIG=mipsel-linux-android + ;; *) GNU_CONFIG="$ARCH-linux-android" ;; diff --git a/android/sample_app/jni/Application.mk b/android/sample_app/jni/Application.mk index 50dcd0d5..366ce29f 100644 --- a/android/sample_app/jni/Application.mk +++ b/android/sample_app/jni/Application.mk @@ -28,4 +28,4 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. APP_STL := stlport_static -APP_ABI := armeabi armeabi-v7a +APP_ABI := all diff --git a/configure b/configure index 27f6bf56..a907872a 100755 --- a/configure +++ b/configure @@ -632,6 +632,7 @@ CCAS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE +am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE @@ -2698,9 +2699,9 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 @@ -2844,6 +2845,7 @@ fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= @@ -3658,6 +3660,7 @@ else # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -3717,7 +3720,7 @@ else break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -3792,6 +3795,7 @@ else # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -3849,7 +3853,7 @@ else break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -4457,6 +4461,7 @@ else # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -4516,7 +4521,7 @@ else break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -5104,6 +5109,7 @@ else # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -5163,7 +5169,7 @@ else break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. diff --git a/src/common/android/include/elf.h b/src/common/android/include/elf.h index debe30be..af50a799 100644 --- a/src/common/android/include/elf.h +++ b/src/common/android/include/elf.h @@ -152,6 +152,10 @@ typedef struct { #define NT_FPREGSET 2 #endif +#if !defined(SHT_MIPS_DWARF) +#define SHT_MIPS_DWARF 0x7000001e +#endif + #ifdef __cplusplus } // extern "C" #endif // __cplusplus diff --git a/src/common/android/include/sgidefs.h b/src/common/android/include/sgidefs.h new file mode 100644 index 00000000..cc8ef5d0 --- /dev/null +++ b/src/common/android/include/sgidefs.h @@ -0,0 +1,51 @@ +// Copyright (c) 2013, 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_SGIDEFS_H +#define GOOGLE_BREAKPAD_ANDROID_INCLUDE_SGIDEFS_H + +#ifdef __mips__ + +#define _MIPS_SIM_ABI32 1 +#define _MIPS_SIM_NABI32 2 +#define _MIPS_SIM_ABI64 3 + +// The following should always be defined by the compiler, +// Verified for Android with GCC 4.6 and Clang 3.1. +#ifndef _MIPS_SIM +#error "Toolchain should define _MIPS_SIM" +#endif + +#ifndef _MIPS_SZPTR +#error "Toolchain should define _MIPS_PTR" +#endif + +#endif // __mips__ + +#endif // GOOGLE_BREAKPAD_ANDROID_INCLUDE_SGIDEFS_H