Skip to content

Commit

Permalink
Bug 1428182 - 6b. Support unified headers in Breakpad code; r=ted
Browse files Browse the repository at this point in the history
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

--HG--
extra : rebase_source : f5c29c9949a48a8376f84dcc676e5f8df886f130
  • Loading branch information
Jim Chen committed Jan 30, 2018
1 parent e0003b1 commit 3daaf65
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions config/system-headers.mozbuild
Expand Up @@ -1050,6 +1050,7 @@ system_headers = [

if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
system_headers += [
'android/api-level.h',
'android/ashmem.h',
'android_audio/AudioSystem.h',
'android/log.h',
Expand Down
Expand Up @@ -106,7 +106,7 @@
#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;
}
Expand Down Expand Up @@ -387,7 +387,7 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
// 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.
Expand Down
4 changes: 0 additions & 4 deletions toolkit/crashreporter/breakpad-client/linux/moz.build
Expand Up @@ -35,8 +35,4 @@ 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')
Expand Up @@ -40,8 +40,8 @@ HOST_CXXFLAGS += [
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')
Expand Down

0 comments on commit 3daaf65

Please sign in to comment.