Bug 1428182 - 6b. Support unified headers in Breakpad code; r=ted
☠☠ backed out by 8d50a77f8437 ☠ ☠
authorJim Chen <nchen@mozilla.com>
Mon, 29 Jan 2018 17:38:14 -0500
changeset 401325 4dd7eaff3ab5e27dadeb690dab0f41026f946e81
parent 401324 fbbb0745b13980d23c0c55b3e6a185b7b1678ca0
child 401326 092662eab5eb18d84f21b7ca8fd2e04ab36a7149
push id33342
push userrgurzau@mozilla.com
push dateTue, 30 Jan 2018 09:59:26 +0000
treeherdermozilla-central@a23e3bbd2019 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1428182
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1428182 - 6b. Support unified headers in Breakpad code; r=ted Fix several problems when building Breakpad with new NDK unified headers. - Unified headers define its own tgkill wrapper, so rename our own wrapper to __tgkill. - Unified headers define user_fpxregs_struct for all API levels, so don't redefine it. - Only the target sources under google-breakpad/src/common/linux should use custom Android headers, so change the includes line in moz.build to use OS_INCLUDES. MozReview-Commit-ID: HGnUMu5vDUM
config/system-headers.mozbuild
toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc
toolkit/crashreporter/breakpad-client/linux/moz.build
toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
--- a/config/system-headers.mozbuild
+++ b/config/system-headers.mozbuild
@@ -1045,16 +1045,17 @@ system_headers = [
     'xcb/shm.h',
     'xcb/xcb.h',
     'xlocale.h',
     'zmouse.h',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     system_headers += [
+        'android/api-level.h',
         'android/ashmem.h',
         'android_audio/AudioSystem.h',
         'android/log.h',
         'android/looper.h',
         'android/native_window.h',
         'android/native_window_jni.h',
         'audio_effects/effect_aec.h',
         'audio_effects/effect_ns.h',
--- a/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc
+++ b/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc
@@ -101,17 +101,17 @@
 #include "linux/sched.h"
 #endif
 
 #ifndef PR_SET_PTRACER
 #define PR_SET_PTRACER 0x59616d61
 #endif
 
 // A wrapper for the tgkill syscall: send a signal to a specific thread.
-static int tgkill(pid_t tgid, pid_t tid, int sig) {
+static int _tgkill(pid_t tgid, pid_t tid, int sig) {
   return syscall(__NR_tgkill, tgid, tid, sig);
   return 0;
 }
 
 namespace google_breakpad {
 
 namespace {
 // The list of signals which we consider to be crashes. The default action for
@@ -382,17 +382,17 @@ void ExceptionHandler::SignalHandler(int
   pthread_mutex_unlock(&g_handler_stack_mutex_);
 
   // info->si_code <= 0 iff SI_FROMUSER (SI_FROMKERNEL otherwise).
   if (info->si_code <= 0 || sig == SIGABRT) {
     // This signal was triggered by somebody sending us the signal with kill().
     // In order to retrigger it, we have to queue a new signal by calling
     // kill() ourselves.  The special case (si_pid == 0 && sig == SIGABRT) is
     // due to the kernel sending a SIGABRT from a user request via SysRQ.
-    if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) {
+    if (_tgkill(getpid(), syscall(__NR_gettid), sig) < 0) {
       // If we failed to kill ourselves (e.g. because a sandbox disallows us
       // to do so), we instead resort to terminating our process. This will
       // result in an incorrect exit code.
       _exit(1);
     }
   } else {
     // This was a synchronous signal triggered by a hard fault (e.g. SIGSEGV).
     // No need to reissue the signal. It will automatically trigger again,
--- a/toolkit/crashreporter/breakpad-client/linux/moz.build
+++ b/toolkit/crashreporter/breakpad-client/linux/moz.build
@@ -30,13 +30,9 @@ if CONFIG['OS_TARGET'] == 'Android':
         '/toolkit/crashreporter/google-breakpad/src/common/android/include',
     ]
 
 # We allow warnings for third-party code that can be updated from upstream.
 AllowCompilerWarnings()
 
 FINAL_LIBRARY = 'xul'
 
-if CONFIG['OS_TARGET'] == 'Android' and CONFIG['CPU_ARCH'] == 'x86':
-    # The NDK's user.h defines this struct with a different name.
-    DEFINES['user_fpxregs_struct'] = 'user_fxsr_struct'
-
 include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
@@ -35,18 +35,18 @@ HOST_SOURCES += [
 HOST_CXXFLAGS += [
     '-O2',
     '-g',
 ]
 
 if CONFIG['OS_TARGET'] == 'Android':
     DEFINES['ANDROID_NDK_MAJOR_VERSION'] = CONFIG['ANDROID_NDK_MAJOR_VERSION']
     DEFINES['ANDROID_NDK_MINOR_VERSION'] = CONFIG['ANDROID_NDK_MINOR_VERSION']
-    LOCAL_INCLUDES += [
-        '/toolkit/crashreporter/google-breakpad/src/common/android/include',
+    COMPILE_FLAGS['OS_INCLUDES'] += [
+        '-I%s/toolkit/crashreporter/google-breakpad/src/common/android/include' % TOPSRCDIR,
     ]
 
 Library('breakpad_linux_common_s')
 
 FINAL_LIBRARY = 'xul'
 
 HOST_DEFINES['NO_STABS_SUPPORT'] = True