Bug 1428182 - 6b. Support unified headers in Breakpad code; r=ted
authorJim Chen <nchen@mozilla.com>
Tue, 30 Jan 2018 14:08:23 -0500
changeset 401571 6f260b258a97ce165809c8e681512830a8a29986
parent 401570 fb4a8fe6bb1aa3eb1b2f682c7a6d18cece1b5c3c
child 401572 7771ab0cabc5b1b237ba66d19a027ae27314b133
push id33350
push userbtara@mozilla.com
push dateWed, 31 Jan 2018 09:59:18 +0000
treeherdermozilla-central@e4df65201940 [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