bug 1069556 - local build changes to match up with upstream Breakpad. r=benwa,glandium
☠☠ backed out by a795dc0652f0 ☠ ☠
authorTed Mielczarek <ted@mielczarek.org>
Mon, 09 Nov 2015 08:14:52 -0500
changeset 318010 31c98f5e107b9271be88e7c8543c4dbb4a2b6526
parent 318009 09fd4f3ab6e764016fe073efb226f03b5969af59
child 318011 168001ae11e485636b98e2db81e20749b8f9d081
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenwa, glandium
bugs1069556
milestone47.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 1069556 - local build changes to match up with upstream Breakpad. r=benwa,glandium This commit contains a few things: * Misc build fixup to sync with upstream--adding a few new moz.build files, source files * The final bits of unhooking Breakpad from the profiler: ** Revert to only building toolkit/crashreporter if MOZ_CRASHREPORTER. ** Stop building bits of Breakpad that we only needed for the profiler. ** Remove a few bits of profiler code that were used to interface with Breakpad. ** Remove toolkit/crashreporter/breakpad-logging, which was only used to suppress Breakpad logging for the in-process stackwalker. * Upstream removed their Android-compat sys/ucontext.h because the Android NDK added it, but the bionic we're using for Gonk builds is too old, so add a copy of the previous version of those files to toolkit/crashreporter/gonk-include to keep Gonk building. * Consolidate moz.build files under toolkit/crashreporter/google-breakpad/client/linux
testing/tools/fileid/moz.build
toolkit/crashreporter/Makefile.in
toolkit/crashreporter/breakpad-logging/BreakpadLogging.cpp
toolkit/crashreporter/breakpad-logging/BreakpadLogging.h
toolkit/crashreporter/breakpad-logging/moz.build
toolkit/crashreporter/client/moz.build
toolkit/crashreporter/crashreporter.mozbuild
toolkit/crashreporter/gonk-include/elf.h
toolkit/crashreporter/gonk-include/link.h
toolkit/crashreporter/gonk-include/stab.h
toolkit/crashreporter/gonk-include/sys/procfs.h
toolkit/crashreporter/gonk-include/sys/signal.h
toolkit/crashreporter/gonk-include/sys/stat.h
toolkit/crashreporter/gonk-include/sys/ucontext.h
toolkit/crashreporter/gonk-include/sys/user.h
toolkit/crashreporter/gonk-include/ucontext.h
toolkit/crashreporter/google-breakpad/src/client/linux/Makefile.in
toolkit/crashreporter/google-breakpad/src/client/linux/crash_generation/moz.build
toolkit/crashreporter/google-breakpad/src/client/linux/handler/Makefile.in
toolkit/crashreporter/google-breakpad/src/client/linux/handler/moz.build
toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/moz.build
toolkit/crashreporter/google-breakpad/src/client/linux/moz.build
toolkit/crashreporter/google-breakpad/src/common/Makefile.in
toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build
toolkit/crashreporter/google-breakpad/src/common/linux/Makefile.in
toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
toolkit/crashreporter/google-breakpad/src/common/moz.build
toolkit/crashreporter/google-breakpad/src/processor/moz.build
toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/moz.build
toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build
toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/moz.build
toolkit/crashreporter/moz.build
toolkit/crashreporter/test/moz.build
toolkit/crashreporter/tools/symbolstore.py
toolkit/moz.build
tools/profiler/core/shim_mac_dump_syms.h
tools/profiler/core/shim_mac_dump_syms.mm
tools/profiler/gecko/local_debug_info_symbolizer.cc
tools/profiler/gecko/local_debug_info_symbolizer.h
tools/profiler/moz.build
xpcom/threads/ThreadStackHelper.cpp
xpcom/threads/moz.build
--- a/testing/tools/fileid/moz.build
+++ b/testing/tools/fileid/moz.build
@@ -16,14 +16,13 @@ if CONFIG['OS_ARCH'] == 'Darwin':
         'breakpad_mac_common_s',
     ]
     SOURCES += ['mac_fileid.cpp']
 
 
 if CONFIG['OS_ARCH'] == 'Linux' or CONFIG['OS_ARCH'] == 'Darwin':
     USE_LIBS += [
         'breakpad_common_s',
-        'breakpad_logging',
     ]
     LOCAL_INCLUDES += [
         '/toolkit/crashreporter/google-breakpad/src',
     ]
     Program('fileid')
deleted file mode 100644
--- a/toolkit/crashreporter/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-ifeq ($(OS_TARGET),Android)
-# NDK5 workarounds
-TARGET_LOCAL_INCLUDES = \
-  -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/android/include/ \
-  $(NULL)
-endif
-
-include $(topsrcdir)/config/rules.mk
-
-check::
-	$(PYTHON) $(srcdir)/tools/unit-symbolstore.py
deleted file mode 100644
--- a/toolkit/crashreporter/breakpad-logging/BreakpadLogging.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "BreakpadLogging.h"
-
-#include <ostream>
-
-namespace mozilla {
-
-// An output stream that acts like /dev/null and drops all output directed to it
-// Passing 0 here causes the ostream to enter an error state, and so it silently
-// drops all output directed to it.
-std::ostream gNullStream(0);
-
-} // namespace mozilla
deleted file mode 100644
--- a/toolkit/crashreporter/breakpad-logging/BreakpadLogging.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef BreakpadLogging_h
-#define BreakpadLogging_h
-
-#include <ostream>
-
-namespace mozilla {
-
-// An output stream that acts like /dev/null and drops all output directed to it
-extern std::ostream gNullStream;
-
-} // namespace mozilla
-
-// Override the breakpad info stream to disable INFO logs
-#define BPLOG_INFO_STREAM mozilla::gNullStream
-
-#endif // BreakpadLogging_h
deleted file mode 100644
--- a/toolkit/crashreporter/breakpad-logging/moz.build
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-UNIFIED_SOURCES += [
-    'BreakpadLogging.cpp',
-]
-
-Library('breakpad_logging')
-
-FINAL_LIBRARY = 'xul'
-
-with Files('**'):
-    BUG_COMPONENT = ('Toolkit', 'Breakpad Integration')
--- a/toolkit/crashreporter/client/moz.build
+++ b/toolkit/crashreporter/client/moz.build
@@ -6,20 +6,16 @@
 
 if CONFIG['OS_TARGET'] != 'Android':
     Program('crashreporter')
 
     UNIFIED_SOURCES += [
         'crashreporter.cpp',
     ]
 
-LOCAL_INCLUDES += [
-    '../google-breakpad/src',
-]
-
 if CONFIG['OS_ARCH'] == 'WINNT':
     UNIFIED_SOURCES += [
         'crashreporter_win.cpp',
     ]
     DEFINES['UNICODE'] = True
     DEFINES['_UNICODE'] = True
     USE_LIBS += [
         'google_breakpad_libxul_staticruntime_s',
@@ -37,17 +33,16 @@ elif CONFIG['OS_ARCH'] == 'Darwin':
         'crashreporter_unix_common.cpp',
     ]
     LOCAL_INCLUDES += [
         '../google-breakpad/src/common/mac',
     ]
     OS_LIBS += ['-framework Cocoa']
     USE_LIBS += [
         'breakpad_common_s',
-        'breakpad_logging',
         'breakpad_mac_common_s',
     ]
 elif CONFIG['OS_ARCH'] == 'SunOS':
     SOURCES += [
         'crashreporter_linux.cpp',
         'crashreporter_unix.cpp',
     ]
     USE_LIBS += [
--- a/toolkit/crashreporter/crashreporter.mozbuild
+++ b/toolkit/crashreporter/crashreporter.mozbuild
@@ -1,17 +1,26 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+LOCAL_INCLUDES += [
+    '/toolkit/crashreporter/google-breakpad/src',
+]
+
 # Suppress warnings in third-party code.
 if CONFIG['_MSC_VER']:
     CXXFLAGS += [
         '-wd4005', # macro redefinition
     ]
 elif CONFIG['GNU_CXX']:
     CXXFLAGS += [
         '-Wno-unused-local-typedefs',
     ]
     if CONFIG['CLANG_CXX']:
         CXXFLAGS += ['-Wno-implicit-fallthrough']
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+    DEFINES['ELFSIZE'] = 32
+
+DEFINES['NO_STABS_SUPPORT'] = True
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/gonk-include/elf.h
@@ -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
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/gonk-include/link.h
@@ -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 */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/gonk-include/stab.h
@@ -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
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/gonk-include/sys/procfs.h
@@ -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
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/gonk-include/sys/signal.h
@@ -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
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/gonk-include/sys/stat.h
@@ -0,0 +1,39 @@
+// 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_STAT_H
+#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H
+
+#include_next <sys/stat.h>
+
+#ifndef S_IRWXU
+#define S_IRWXU  00700
+#endif
+
+#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/gonk-include/sys/ucontext.h
@@ -0,0 +1,175 @@
+// 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_UCONTEXT_H
+#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_UCONTEXT_H
+
+#include <sys/cdefs.h>
+#include <signal.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.
+#include <asm/sigcontext.h>
+typedef struct sigcontext mcontext_t;
+
+// The ARM kernel uses a 64-bit signal mask.
+typedef uint32_t  kernel_sigmask_t[2];
+
+typedef struct ucontext {
+  uint32_t uc_flags;
+  struct ucontext* uc_link;
+  stack_t uc_stack;
+  mcontext_t uc_mcontext;
+  kernel_sigmask_t uc_sigmask;
+  // Other fields are not used by Google Breakpad. Don't define them.
+} ucontext_t;
+
+#elif defined(__i386__)
+
+/* 80-bit floating-point register */
+struct _libc_fpreg {
+  unsigned short significand[4];
+  unsigned short exponent;
+};
+
+/* Simple floating-point state, see FNSTENV instruction */
+struct _libc_fpstate {
+  unsigned long cw;
+  unsigned long sw;
+  unsigned long tag;
+  unsigned long ipoff;
+  unsigned long cssel;
+  unsigned long dataoff;
+  unsigned long datasel;
+  struct _libc_fpreg _st[8];
+  unsigned long status;
+};
+
+typedef uint32_t  greg_t;
+
+typedef struct {
+  uint32_t gregs[19];
+  struct _libc_fpstate* fpregs;
+  uint32_t oldmask;
+  uint32_t cr2;
+} mcontext_t;
+
+enum {
+  REG_GS = 0,
+  REG_FS,
+  REG_ES,
+  REG_DS,
+  REG_EDI,
+  REG_ESI,
+  REG_EBP,
+  REG_ESP,
+  REG_EBX,
+  REG_EDX,
+  REG_ECX,
+  REG_EAX,
+  REG_TRAPNO,
+  REG_ERR,
+  REG_EIP,
+  REG_CS,
+  REG_EFL,
+  REG_UESP,
+  REG_SS,
+};
+
+// The i386 kernel uses a 64-bit signal mask.
+typedef uint32_t kernel_sigmask_t[2];
+
+typedef struct ucontext {
+  uint32_t uc_flags;
+  struct ucontext* uc_link;
+  stack_t uc_stack;
+  mcontext_t uc_mcontext;
+  kernel_sigmask_t uc_sigmask;
+  struct _libc_fpstate __fpregs_mem;
+} ucontext_t;
+
+#elif defined(__mips__)
+
+// Not supported by Google Breakpad at this point, but just in case.
+typedef struct {
+  uint32_t regmask;
+  uint32_t status;
+  uint64_t pc;
+  uint64_t gregs[32];
+  uint64_t fpregs[32];
+  uint32_t acx;
+  uint32_t fpc_csr;
+  uint32_t fpc_eir;
+  uint32_t used_math;
+  uint32_t dsp;
+  uint64_t mdhi;
+  uint64_t mdlo;
+  uint32_t hi1;
+  uint32_t lo1;
+  uint32_t hi2;
+  uint32_t lo2;
+  uint32_t hi3;
+  uint32_t lo3;
+} mcontext_t;
+
+// The MIPS kernel uses a 128-bit signal mask.
+typedef uint32_t kernel_sigmask_t[4];
+
+typedef struct ucontext {
+  uint32_t uc_flags;
+  struct ucontext* uc_link;
+  stack_t uc_stack;
+  mcontext_t uc_mcontext;
+  kernel_sigmask_t uc_sigmask;
+  // Other fields are not used by Google Breakpad. Don't define them.
+} ucontext_t;
+
+#else
+#  error "Unsupported Android CPU ABI!"
+#endif
+
+#endif  // __BIONIC_HAVE_UCONTEXT_T
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif  // __cplusplus
+
+#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_UCONTEXT_H
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/gonk-include/sys/user.h
@@ -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
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/gonk-include/ucontext.h
@@ -0,0 +1,55 @@
+// 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/cdefs.h>
+#include <signal.h>
+
+#ifdef __BIONIC_HAVE_UCONTEXT_H
+# include_next <ucontext.h>
+#else
+# include <sys/ucontext.h>
+#endif  // __BIONIC_UCONTEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif  // __cplusplus
+
+// Provided by src/android/common/breakpad_getcontext.S
+int breakpad_getcontext(ucontext_t* ucp);
+
+#define getcontext(x)   breakpad_getcontext(x)
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif  // __cplusplus
+
+#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_UCONTEXT_H
rename from toolkit/crashreporter/google-breakpad/src/client/linux/handler/Makefile.in
rename to toolkit/crashreporter/google-breakpad/src/client/linux/Makefile.in
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/client/linux/Makefile.in
@@ -1,12 +1,20 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+ifeq (Android,$(OS_TARGET))
+ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
+TARGET_LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/crashreporter/gonk-include/
+else
+TARGET_LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/android/include/
+endif
+endif
+
 ifdef MOZ_THUMB2 #{
 # The syscall number is passed through r7 in the linux ARM ABI, but r7
 # is also the THUMB frame pointer.  (Unfortunate, but ah well.)  gcc
 # complains if we store to r7, not unreasonably, but complains
 # inconsistently.  The generic syscall template pushes/stores to/pops
 # r7 with no complaint from gcc, but the sys_clone() function marks r7
 # as a clobbered register yet gcc error's.  The generated assembly for
 # sys_clone() looks OK, so we chalk this up to a gcc/gas quirk and
deleted file mode 100644
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/crash_generation/moz.build
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-UNIFIED_SOURCES += [
-    'crash_generation_client.cc',
-    'crash_generation_server.cc',
-]
-
-# We allow warnings for third-party code that can be updated from upstream.
-ALLOW_COMPILER_WARNINGS = True
-
-FINAL_LIBRARY = 'xul'
-
-LOCAL_INCLUDES += [
-    '/toolkit/crashreporter/google-breakpad/src',
-]
-
-if CONFIG['OS_TARGET'] == 'Android':
-    LOCAL_INCLUDES += [
-        '/toolkit/crashreporter/google-breakpad/src/common/android/include',
-    ]
-
-include('/toolkit/crashreporter/crashreporter.mozbuild')
deleted file mode 100644
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/moz.build
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-UNIFIED_SOURCES += [
-    '../log/log.cc',
-    'exception_handler.cc',
-    'minidump_descriptor.cc',
-]
-
-# We allow warnings for third-party code that can be updated from upstream.
-ALLOW_COMPILER_WARNINGS = True
-
-FINAL_LIBRARY = 'xul'
-
-if CONFIG['OS_TARGET'] == 'Android':
-    # NDK5 workarounds
-    DEFINES['_STLP_CONST_CONSTRUCTOR_BUG'] = True
-    DEFINES['_STLP_NO_MEMBER_TEMPLATES'] = True
-    LOCAL_INCLUDES += [
-        '/toolkit/crashreporter/google-breakpad/src/common/android/include',
-    ]
-
-LOCAL_INCLUDES += [
-    '/toolkit/crashreporter/google-breakpad/src',
-]
-
-include('/toolkit/crashreporter/crashreporter.mozbuild')
deleted file mode 100644
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/moz.build
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-UNIFIED_SOURCES += [
-    'linux_dumper.cc',
-    'linux_ptrace_dumper.cc',
-    'minidump_writer.cc',
-]
-
-FINAL_LIBRARY = 'xul'
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    DEFINES['ELFSIZE'] = 32
-
-LOCAL_INCLUDES += [
-    '/toolkit/crashreporter/google-breakpad/src',
-]
-
-if CONFIG['OS_TARGET'] == 'Android':
-    LOCAL_INCLUDES += [
-        '/toolkit/crashreporter/google-breakpad/src/common/android/include',
-    ]
-
-include('/toolkit/crashreporter/crashreporter.mozbuild')
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build
@@ -0,0 +1,33 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+UNIFIED_SOURCES += [
+    'crash_generation/crash_generation_client.cc',
+    'crash_generation/crash_generation_server.cc',
+    'dump_writer_common/thread_info.cc',
+    'dump_writer_common/ucontext_reader.cc',
+    'handler/exception_handler.cc',
+    'handler/minidump_descriptor.cc',
+    'log/log.cc',
+    'microdump_writer/microdump_writer.cc',
+    'minidump_writer/linux_dumper.cc',
+    'minidump_writer/linux_ptrace_dumper.cc',
+    'minidump_writer/minidump_writer.cc',
+]
+
+# We allow warnings for third-party code that can be updated from upstream.
+ALLOW_COMPILER_WARNINGS = True
+
+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'
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+    DEFINES['getcontext'] = 'breakpad_getcontext'
+
+include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/common/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/common/Makefile.in
@@ -1,9 +1,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-ifeq ($(OS_TARGET),Android)
+ifeq (Android,$(OS_TARGET))
+ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
+TARGET_LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/crashreporter/gonk-include/
+else
 TARGET_LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/android/include/
 endif
+endif
 
 include $(topsrcdir)/config/rules.mk
+
+# memory.h in this dir breaks things if -I$(srcdir) gets added, since memory.h
+# is also a system header and the copy here winds up getting included instead.
+INCLUDES := $(LOCAL_INCLUDES) -I$(DIST)/include
--- a/toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build
@@ -1,32 +1,29 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-if CONFIG['MOZ_CRASHREPORTER']:
-    HostLibrary('host_breakpad_dwarf_s')
-    HOST_SOURCES += [
-        'bytereader.cc',
-        'dwarf2diehandler.cc',
-        'dwarf2reader.cc',
-        'functioninfo.cc',
-    ]
-    HOST_CXXFLAGS += [
-        '-O2',
-        '-g',
-    ]
-    LOCAL_INCLUDES += [
-        '../..',
-    ]
+HostLibrary('host_breakpad_dwarf_s')
+HOST_SOURCES += [
+    'bytereader.cc',
+    'dwarf2diehandler.cc',
+    'dwarf2reader.cc',
+    'functioninfo.cc',
+]
+HOST_CXXFLAGS += [
+    '-O2',
+    '-g',
+]
 
 # need static lib
 FORCE_STATIC_LIB = True
 
 # This code is only compiled for build-time tools,
 # so enabling RTTI should be fine.
 HOST_CXXFLAGS += [
     '-frtti',
     '-funsigned-char',
 ]
 
+include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/common/linux/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/common/linux/Makefile.in
@@ -1,13 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-ifneq (Android,$(OS_TARGET))
+ifeq (Android,$(OS_TARGET))
+ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
+TARGET_LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/crashreporter/gonk-include/
 else
 TARGET_LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/android/include/
 endif
+endif
 
 include $(topsrcdir)/config/rules.mk
 
 # See https://bugzilla.mozilla.org/show_bug.cgi?id=741348#c11
 file_id.$(OBJ_SUFFIX): DISABLE_STL_WRAPPING := 1
--- a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
@@ -17,37 +17,32 @@ SOURCES += [
     'file_id.cc',
 ]
 
 if CONFIG['OS_TARGET'] != 'Android':
     UNIFIED_SOURCES += [
         'http_upload.cc',
     ]
 
-if CONFIG['MOZ_CRASHREPORTER']:
-    HostLibrary('host_breakpad_linux_common_s')
-    HOST_SOURCES += [
-        'dump_symbols.cc',
-        'elf_symbols_to_module.cc',
-        'elfutils.cc',
-        'file_id.cc',
-        'guid_creator.cc',
-        'linux_libc_support.cc',
-        'memory_mapped_file.cc',
-    ]
-    HOST_CXXFLAGS += [
-        '-O2',
-        '-g',
-    ]
+HostLibrary('host_breakpad_linux_common_s')
+HOST_SOURCES += [
+    'crc32.cc',
+    'dump_symbols.cc',
+    'elf_symbols_to_module.cc',
+    'elfutils.cc',
+    'file_id.cc',
+    'guid_creator.cc',
+    'linux_libc_support.cc',
+    'memory_mapped_file.cc',
+]
+
+HOST_CXXFLAGS += [
+    '-O2',
+    '-g',
+]
 
 Library('breakpad_linux_common_s')
 
 FINAL_LIBRARY = 'xul'
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    DEFINES['ELFSIZE'] = 32
-
-DEFINES['NO_STABS_SUPPORT'] = True
+HOST_DEFINES['NO_STABS_SUPPORT'] = True
 
-LOCAL_INCLUDES += [
-    '/toolkit/crashreporter/google-breakpad/src',
-]
-
+include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
@@ -41,13 +41,11 @@ SOURCES += [
 
 Library('breakpad_mac_common_s')
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
-LOCAL_INCLUDES += [
-    '../..',
-]
+CMFLAGS += ['-std=c99']
 
-CMFLAGS += ['-std=c99']
+include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -4,106 +4,62 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if CONFIG['OS_ARCH'] in ('Darwin', 'Linux'):
     DIRS += ['dwarf']
 
 UNIFIED_SOURCES += [
     'convert_UTF.c',
-    'logging.cc',
-    'module.cc',
-    'pathname_stripper.cc',
     'string_conversion.cc',
-    'unique_string.cc',
 ]
 
 if CONFIG['OS_ARCH'] != 'WINNT':
     UNIFIED_SOURCES += [
-        'arm_ex_reader.cc',
-        'arm_ex_to_module.cc',
-        'dwarf/bytereader.cc',
-        'dwarf/dwarf2diehandler.cc',
-        'dwarf/dwarf2reader.cc',
-        'dwarf_cfi_to_module.cc',
-        'dwarf_cu_to_module.cc',
-        'dwarf_line_to_module.cc',
-        'language.cc',
         'md5.cc',
     ]
 
 if CONFIG['OS_ARCH'] == 'Linux':
-    UNIFIED_SOURCES += [
-        'linux/dump_symbols.cc',
-        'linux/elf_symbols_to_module.cc',
-    ]
     HOST_DEFINES['HAVE_A_OUT_H'] = True
-    DEFINES['HAVE_A_OUT_H'] = True
-
-if CONFIG['OS_ARCH'] == 'Darwin' and CONFIG['HOST_OS_ARCH'] != 'Darwin':
-    HOST_CXXFLAGS += [
-        '-I%s/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/' % TOPSRCDIR,
-    ]
-
-if CONFIG['OS_TARGET'] != 'Android' and CONFIG['OS_ARCH'] != 'WINNT':
-    UNIFIED_SOURCES += [
+elif CONFIG['OS_ARCH'] == 'Darwin':
+    HOST_DEFINES['HAVE_MACH_O_NLIST_H'] = True
+    HOST_SOURCES += [
         'stabs_reader.cc',
         'stabs_to_module.cc',
     ]
+    if CONFIG['HOST_OS_ARCH'] != 'Darwin':
+        HOST_CXXFLAGS += [
+            '-I%s/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/' % TOPSRCDIR,
+        ]
 
-if CONFIG['OS_ARCH'] != 'WINNT' and CONFIG['MOZ_CRASHREPORTER']:
+if CONFIG['OS_ARCH'] != 'WINNT':
     HOST_SOURCES += [
         'arm_ex_reader.cc',
         'arm_ex_to_module.cc',
         'convert_UTF.c',
         'dwarf_cfi_to_module.cc',
         'dwarf_cu_to_module.cc',
         'dwarf_line_to_module.cc',
         'language.cc',
-        'logging.cc',
         'md5.cc',
         'module.cc',
-        'pathname_stripper.cc',
-        'stabs_reader.cc',
-        'stabs_to_module.cc',
         'string_conversion.cc',
-        'unique_string.cc',
     ]
     HOST_CXXFLAGS += [
         '-O2',
         '-g',
     ]
     HostLibrary('host_breakpad_common_s')
 
-if CONFIG['OS_ARCH'] == 'Darwin':
-    UNIFIED_SOURCES += [
-        'mac/dump_syms.cc',
-    ]
-    HOST_DEFINES['HAVE_MACH_O_NLIST_H'] = True
-    DEFINES['HAVE_MACH_O_NLIST_H'] = True
-
 if CONFIG['OS_TARGET'] == 'Android':
     # We don't support unifying assembly files.
     SOURCES += [
         'android/breakpad_getcontext.S',
     ]
 
 Library('breakpad_common_s')
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    DEFINES['ELFSIZE'] = 32
-
-if CONFIG['OS_TARGET'] == 'Android':
-    DEFINES['NO_STABS_SUPPORT'] = True
-
-DEFINES['BP_LOGGING_INCLUDE'] = '"BreakpadLogging.h"'
-
 include('/toolkit/crashreporter/crashreporter.mozbuild')
-
-LOCAL_INCLUDES += [
-    '..',
-    '../../../breakpad-logging',
-]
--- a/toolkit/crashreporter/google-breakpad/src/processor/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/processor/moz.build
@@ -24,14 +24,12 @@ UNIFIED_SOURCES += [
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 DEFINES['BP_LOGGING_INCLUDE'] = '"BreakpadLogging.h"'
 
 LOCAL_INCLUDES += [
-    '..',
-    '../..',
     '../../../breakpad-logging',
 ]
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/moz.build
@@ -22,12 +22,12 @@ HOST_USE_LIBS += [
     'host_breakpad_dwarf_s',
 ]
 
 # The HostProgram template may append 'host_stdc++compat' to
 # HOST_USE_LIBS, which needs to appear after the entries above.
 HostProgram('dump_syms')
 
 LOCAL_INCLUDES += [
-    '../../..',
     '../../../common/linux',
 ]
 
+include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build
@@ -22,16 +22,17 @@ HOST_USE_LIBS += [
     'host_breakpad_dwarf_s',
 ]
 
 # The HostProgram template may append 'host_stdc++compat' to
 # HOST_USE_LIBS, which needs to appear after the entries above.
 HostProgram('dump_syms')
 
 LOCAL_INCLUDES += [
-    '../../..',
     '../../../common/mac',
 ]
 
 if CONFIG['HOST_OS_ARCH'] != 'Darwin':
     HOST_CXXFLAGS += [
         '-I%s/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/' % TOPSRCDIR,
     ]
+
+include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/moz.build
@@ -18,12 +18,12 @@ HOST_USE_LIBS += [
     'host_breakpad_solaris_common_s',
 ]
 
 # The HostProgram template may append 'host_stdc++compat' to
 # HOST_USE_LIBS, which needs to appear after the entries above.
 HostProgram('dump_syms')
 
 LOCAL_INCLUDES += [
-    '../../..',
     '../../../common/solaris',
 ]
 
+include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/moz.build
+++ b/toolkit/crashreporter/moz.build
@@ -4,57 +4,51 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SPHINX_TREES['crashreporter'] = 'docs'
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     DIRS += [
     'google-breakpad/src/common',
-    'google-breakpad/src/processor',
     'breakpad-windows-libxul'
     ]
 
     if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
         DIRS += ['breakpad-windows-standalone']
 
 elif CONFIG['OS_ARCH'] == 'Darwin':
     DIRS += [
         'google-breakpad/src/common',
         'google-breakpad/src/common/mac',
         'google-breakpad/src/client',
         'google-breakpad/src/client/mac/crash_generation',
         'google-breakpad/src/client/mac/handler',
-        'google-breakpad/src/processor',
         'google-breakpad/src/tools/mac/dump_syms',
     ]
 
 elif CONFIG['OS_ARCH'] == 'Linux':
     DIRS += [
         'google-breakpad/src/common',
         'google-breakpad/src/common/linux',
         'google-breakpad/src/client',
-        'google-breakpad/src/client/linux/crash_generation',
-        'google-breakpad/src/client/linux/handler',
-        'google-breakpad/src/client/linux/minidump_writer',
-        'google-breakpad/src/processor',
+        'google-breakpad/src/client/linux/',
         'google-breakpad/src/tools/linux/dump_syms',
     ]
 
 elif CONFIG['OS_ARCH'] == 'SunOS':
     DIRS += [
         'google-breakpad/src/common',
         'google-breakpad/src/common/solaris',
         'google-breakpad/src/client',
         'google-breakpad/src/client/solaris/handler',
         'google-breakpad/src/tools/solaris/dump_syms',
     ]
 
 DIRS += [
-    'breakpad-logging',
     'client',
 ]
 
 if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
     DIRS += ['injector']
     UNIFIED_SOURCES += [
         'InjectCrashReporter.cpp',
         'LoadLibraryRemote.cpp',
@@ -85,26 +79,38 @@ include('/ipc/chromium/chromium-config.m
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['OS_TARGET'] == 'Android':
     DEFINES['ANDROID_PACKAGE_NAME'] = '"%s"' % CONFIG['ANDROID_PACKAGE_NAME']
     # NDK5 workarounds
     DEFINES['_STLP_CONST_CONSTRUCTOR_BUG'] = True
     DEFINES['_STLP_NO_MEMBER_TEMPLATES'] = True
+    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+        LOCAL_INCLUDES += [
+            '/toolkit/crashreporter/gonk-include',
+        ]
+    else:
+        LOCAL_INCLUDES += [
+            '/toolkit/crashreporter/google-breakpad/src/common/android/include',
+        ]
 
 if CONFIG['OS_ARCH'] == 'SunOS':
     # there's no define for this normally
     DEFINES['XP_SOLARIS'] = True
 
 DEFINES['UNICODE'] = True
 DEFINES['_UNICODE'] = True
 
 JAR_MANIFESTS += ['jar.mn']
 
 LOCAL_INCLUDES += [
     'google-breakpad/src',
 ]
 
+PYTHON_UNIT_TESTS += [
+    'tools/unit-symbolstore.py',
+]
+
 include('/toolkit/crashreporter/crashreporter.mozbuild')
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'Breakpad Integration')
--- a/toolkit/crashreporter/test/moz.build
+++ b/toolkit/crashreporter/test/moz.build
@@ -4,31 +4,30 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 DIST_INSTALL = False
 
 XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini', 'unit_ipc/xpcshell.ini']
 BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
 
 UNIFIED_SOURCES += [
-    '../google-breakpad/src/common/logging.cc',
-    '../google-breakpad/src/common/pathname_stripper.cc',
     '../google-breakpad/src/processor/basic_code_modules.cc',
+    '../google-breakpad/src/processor/dump_context.cc',
+    '../google-breakpad/src/processor/dump_object.cc',
+    '../google-breakpad/src/processor/logging.cc',
     '../google-breakpad/src/processor/minidump.cc',
+    '../google-breakpad/src/processor/pathname_stripper.cc',
+    '../google-breakpad/src/processor/proc_maps_linux.cc',
     'dumputils.cpp',
     'nsTestCrasher.cpp',
 ]
 
 GeckoSharedLibrary('testcrasher')
 
 DEFINES['SHARED_LIBRARY'] = '%s%s%s' % (
     CONFIG['DLL_PREFIX'],
     LIBRARY_NAME,
     CONFIG['DLL_SUFFIX']
 )
 
-LOCAL_INCLUDES += [
-    '../google-breakpad/src/',
-]
-
 include('/toolkit/crashreporter/crashreporter.mozbuild')
 
 NO_PGO = True
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -614,29 +614,36 @@ class Dumper:
 
         # tries to get the vcs root from the .mozconfig first - if it's not set
         # the tinderbox vcs path will be assigned further down
         vcs_root = os.environ.get("SRCSRV_ROOT")
         for arch_num, arch in enumerate(self.archs):
             self.files_record[files] = 0 # record that we submitted jobs for this tuple of files
             self.SubmitJob(files[-1], 'ProcessFilesWork', args=(files, arch_num, arch, vcs_root, after, after_arg), callback=self.ProcessFilesFinished)
 
+    def dump_syms_cmdline(self, file, arch, files):
+        '''
+        Get the commandline used to invoke dump_syms.
+        '''
+        # The Mac dumper overrides this.
+        return [self.dump_syms, file]
+
     def ProcessFilesWork(self, files, arch_num, arch, vcs_root, after, after_arg):
         t_start = time.time()
         self.output_pid(sys.stderr, "Worker processing files: %s" % (files,))
 
         # our result is a status, a cleanup function, an argument to that function, and the tuple of files we were called on
         result = { 'status' : False, 'after' : after, 'after_arg' : after_arg, 'files' : files }
 
         sourceFileStream = ''
         code_id, code_file = None, None
         for file in files:
             # files is a tuple of files, containing fallbacks in case the first file doesn't process successfully
             try:
-                cmd = [self.dump_syms] + arch.split() + [file]
+                cmd = self.dump_syms_cmdline(file, arch, files)
                 self.output_pid(sys.stderr, ' '.join(cmd))
                 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                                         stderr=open(os.devnull, 'wb'))
                 module_line = proc.stdout.next()
                 if module_line.startswith("MODULE"):
                     # MODULE os cpu guid debug_file
                     (guid, debug_file) = (module_line.split())[3:5]
                     # strip off .pdb extensions, and append .sym
@@ -903,16 +910,27 @@ class Dumper_Mac(Dumper):
         self.output_pid(sys.stderr, "Submitting job for Mac pre-processing on file: %s" % (files[0]))
         self.SubmitJob(files[0], 'ProcessFilesWorkMac', args=(files[0],), callback=self.ProcessFilesMacFinished)
 
     def ProcessFilesMacFinished(self, result):
         if result['status']:
             # kick off new jobs per-arch with our new list of files
             Dumper.ProcessFiles(self, result['files'], after=AfterMac, after_arg=result['files'][0])
 
+    def dump_syms_cmdline(self, file, arch, files):
+        '''
+        Get the commandline used to invoke dump_syms.
+        '''
+        # dump_syms wants the path to the original binary and the .dSYM
+        # in order to dump all the symbols.
+        if len(files) == 2 and file == files[0] and file.endswith('.dSYM'):
+            # This is the .dSYM bundle.
+            return [self.dump_syms] + arch.split() + ['-g', file, files[1]]
+        return Dumper.dump_syms_cmdline(self, file, arch, files)
+
     def ProcessFilesWorkMac(self, file):
         """dump_syms on Mac needs to be run on a dSYM bundle produced
         by dsymutil(1), so run dsymutil here and pass the bundle name
         down to the superclass method instead."""
         t_start = time.time()
         self.output_pid(sys.stderr, "Worker running Mac pre-processing on file: %s" % (file,))
 
         # our return is a status and a tuple of files to dump symbols for
--- a/toolkit/moz.build
+++ b/toolkit/moz.build
@@ -46,28 +46,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
     DIRS += ['system/osxproxy']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     DIRS += ['system/windowsproxy']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     DIRS += ['system/androidproxy']
 
 if CONFIG['MOZ_CRASHREPORTER']:
     DIRS += ['crashreporter']
-elif CONFIG['MOZ_ENABLE_PROFILER_SPS']:
-    # Profiler requires some crashreporter code,
-    # so build it even if crashreporter is disabled.
-    DIRS += [
-    'crashreporter/breakpad-logging',
-    'crashreporter/google-breakpad/src/common',
-    'crashreporter/google-breakpad/src/processor',
-    ]
-    if CONFIG['OS_ARCH'] == 'Darwin':
-        DIRS += ['crashreporter/google-breakpad/src/common/mac']
-    elif CONFIG['OS_ARCH'] == 'Linux':
-        DIRS += ['crashreporter/google-breakpad/src/common/linux']
 
 with Files('mozapps/installer/windows/*'):
     BUG_COMPONENT = ('Toolkit', 'NSIS Installer')
 
 with Files('pluginproblem/*'):
     BUG_COMPONENT = ('Core', 'Plug-ins')
 
 with Files('mozapps/preferences/*'):
deleted file mode 100644
--- a/tools/profiler/core/shim_mac_dump_syms.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Read debug info from |obj_file| and park it in a Module, returned
-// via |module|.  Caller owns the Module and is responsible for
-// deallocating it.  Note that |debug_dirs| is ignored.
-bool ReadSymbolData_DARWIN(const string& obj_file,
-                           const std::vector<string> &debug_dirs,
-                           SymbolData symbol_data,
-                           google_breakpad::Module** module);
deleted file mode 100644
--- a/tools/profiler/core/shim_mac_dump_syms.mm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "common/mac/dump_syms.h"
-#include "shim_mac_dump_syms.h"
-
-bool ReadSymbolData_DARWIN(const string& obj_file,
-                           const std::vector<string> &debug_dirs,
-                           SymbolData symbol_data,
-                           google_breakpad::Module** module)
-{
-  google_breakpad::DumpSymbols ds(symbol_data);
-
-  if (!ds.Read(obj_file))
-    return false;
-
-  return ds.ReadSymbolData(module);
-}
deleted file mode 100644
--- a/tools/profiler/gecko/local_debug_info_symbolizer.cc
+++ /dev/null
@@ -1,307 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "PlatformMacros.h"
-#include "nsAutoPtr.h"
-
-#if !defined(SPS_OS_windows)
-# include "common/module.h"
-# include "processor/cfi_frame_info.h"
-#endif
-#include "google_breakpad/processor/code_module.h"
-#include "google_breakpad/processor/code_modules.h"
-#include "google_breakpad/processor/stack_frame.h"
-#include "common/logging.h"
-
-#if defined(SPS_PLAT_amd64_linux) || defined(SPS_PLAT_arm_android) \
-    || defined(SPS_PLAT_x86_linux) || defined(SPS_PLAT_x86_android)
-# include "common/linux/dump_symbols.h"
-#elif defined(SPS_PLAT_amd64_darwin) || defined(SPS_PLAT_x86_darwin)
-# include "shim_mac_dump_syms.h"
-#elif defined(SPS_OS_windows)
-  /* This is all stubbed out anyway, so don't do anything. */
-#else
-# error "Unknown platform"
-#endif
-
-#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
-# include "mozilla/Types.h"
-# include "ElfLoader.h"
-# include <dlfcn.h>
-# include <sys/mman.h>
-# include "nsString.h"
-# include "nsDirectoryServiceUtils.h"
-# include "nsDirectoryServiceDefs.h"
-# include <sys/stat.h>
-# include <fcntl.h>
-#endif
-
-#include "local_debug_info_symbolizer.h"
-
-namespace google_breakpad {
-
-LocalDebugInfoSymbolizer::~LocalDebugInfoSymbolizer() {
-# if !defined(SPS_OS_windows)
-  for (SymbolMap::iterator it = symbols_.begin();
-       it != symbols_.end();
-       ++it) {
-    delete it->second;
-  }
-# endif
-}
-
-#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
-
-// Find out where the installation's lib directory is, since we'll
-// have to look in there to get hold of libmozglue.so.  Returned
-// C string is heap allocated and the caller must deallocate it.
-static char* get_installation_lib_dir ( void )
-{
-  nsCOMPtr<nsIProperties>
-    directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
-  if (!directoryService) return NULL;
-  nsCOMPtr<nsIFile> greDir;
-  nsresult rv = directoryService->Get(NS_GRE_DIR, NS_GET_IID(nsIFile),
-                                      getter_AddRefs(greDir));
-  if (NS_FAILED(rv)) return NULL;
-  nsCString path;
-  rv = greDir->GetNativePath(path);
-  if (NS_FAILED(rv)) return NULL;
-  return strdup(path.get());
-}
-
-// Read symbol data from a file on Android.  OBJ_FILENAME has
-// three possible cases:
-//
-// (1) /foo/bar/xyzzy/blah.apk!/libwurble.so
-//     We hand it as-is to faulty.lib and let it fish the relevant
-//     bits out of the APK.
-//
-// (2) libmozglue.so
-//     This is part of the Fennec installation, but is not in the
-//     APK.  Instead we have to figure out the installation path
-//     and look for it there. Because of faulty.lib limitations,
-//     we have to use regular open/mmap instead of faulty.lib.
-//
-// (3) libanythingelse.so
-//     faulty.lib assumes this is a system library, and prepends
-//     "/system/lib/" to the path.  So as in (1), we can give it
-//     as-is to faulty.lib.
-//
-// Hence only (2) requires special-casing here.
-//
-static bool ReadSymbolData_ANDROID(const string& obj_filename,
-                                   const std::vector<string>& debug_dirs,
-                                   SymbolData symbol_data,
-                                   Module** module)
-{
-  string obj_file_to_use = obj_filename;
-
-  // Do (2) in the comment above.
-  if (obj_file_to_use == "libmozglue.so") {
-    char* libdir = get_installation_lib_dir();
-    if (libdir) {
-      obj_file_to_use = string(libdir) + "/lib/" + obj_file_to_use;
-      free(libdir);
-    }
-
-    // Use regular open/mmap here because of faulty.lib limitations
-    int fd = open(obj_file_to_use.c_str(), O_RDONLY);
-    if (fd == -1) {
-      BPLOG(INFO) << "ReadSymbolData_APK: Failed to open \'"
-                  << obj_file_to_use << "\'";
-      return false;
-    }
-
-    struct stat st;
-    if (fstat(fd, &st) != 0) {
-      close(fd);
-      BPLOG(INFO) << "ReadSymbolData_APK: Failed to fstat \'"
-                  << obj_file_to_use << "\'";
-      return false;
-    }
-
-    void* image = mmap(nullptr, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
-    if (image == MAP_FAILED) {
-      close(fd);
-      BPLOG(INFO) << "ReadSymbolData_APK: Failed to mmap \'"
-                  << obj_file_to_use << "\'";
-      return false;
-    }
-
-    bool ok = ReadSymbolDataInternal((const uint8_t*)image,
-                                     obj_file_to_use, debug_dirs,
-                                     symbol_data, module);
-    munmap(image, st.st_size);
-    close(fd);
-    return ok;
-  }
-
-  // Regardless of whether the file is inside an APK or not, we ask
-  // faulty.lib to map it, then call ReadSymbolDataInternal, then
-  // unmap and dlclose it.
-  void* hdl = dlopen(obj_file_to_use.c_str(), RTLD_GLOBAL | RTLD_LAZY);
-  if (!hdl) {
-    BPLOG(INFO) << "ReadSymbolData_APK: Failed to get handle for ELF file \'"
-                << obj_file_to_use << "\'";
-    return false;
-  }
-
-  size_t sz = __dl_get_mappable_length(hdl);
-  if (sz == 0) {
-    dlclose(hdl);
-    BPLOG(INFO) << "ReadSymbolData_APK: Unable to get size for ELF file \'"
-                << obj_file_to_use << "\'";
-    return false;
-  }
-
-  void* image = __dl_mmap(hdl, NULL, sz, 0);
-  if (image == MAP_FAILED) {
-    dlclose(hdl);
-    BPLOG(INFO) << "ReadSymbolData_APK: Failed to mmap ELF file \'"
-                << obj_file_to_use << "\'";
-    return false;
-  }
-
-  bool ok = ReadSymbolDataInternal((const uint8_t*)image,
-                                   obj_file_to_use, debug_dirs,
-                                   symbol_data, module);
-  __dl_munmap(hdl, image, sz);
-  dlclose(hdl);
-
-  return ok;
-}
-#endif /* defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK) */
-
-
-StackFrameSymbolizer::SymbolizerResult
-LocalDebugInfoSymbolizer::FillSourceLineInfo(const CodeModules* modules,
-                                             const SystemInfo* system_info,
-                                             StackFrame* frame) {
-  if (!modules) {
-    return kError;
-  }
-  const CodeModule* module = modules->GetModuleForAddress(frame->instruction);
-  if (!module) {
-    return kError;
-  }
-  frame->module = module;
-
-# if !defined(SPS_OS_windows)
-  Module* debug_info_module = NULL;
-  SymbolMap::const_iterator it = symbols_.find(module->code_file());
-  if (it == symbols_.end()) {
-    if (no_symbol_modules_.find(module->code_file()) !=
-        no_symbol_modules_.end()) {
-      return kNoError;
-    }
-
-    bool ok = false;
-#   if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
-    ok = ReadSymbolData_ANDROID(module->code_file(), debug_dirs_,
-                                ONLY_CFI, &debug_info_module);
-#   elif defined(SPS_PLAT_amd64_darwin) || defined(SPS_PLAT_x86_darwin)
-    ok = ReadSymbolData_DARWIN(module->code_file(), debug_dirs_,
-                        ONLY_CFI, &debug_info_module);
-#   else
-    ok = ReadSymbolData(module->code_file(), debug_dirs_,
-                        ONLY_CFI, &debug_info_module);
-#   endif
-
-    if (!ok) {
-      if (debug_info_module)
-        delete debug_info_module;
-      no_symbol_modules_.insert(module->code_file());
-      return kNoError;
-    }
-
-    symbols_[module->code_file()] = debug_info_module;
-  } else {
-    debug_info_module = it->second;
-  }
-
-  uint64_t address = frame->instruction - frame->module->base_address();
-  Module::Function* function =
-      debug_info_module->FindFunctionByAddress(address);
-  if (function) {
-    frame->function_name = function->name;
-    //TODO: line info: function->lines
-  } else {
-    Module::Extern* ex = debug_info_module->FindExternByAddress(address);
-    if (ex) {
-      frame->function_name = ex->name;
-    }
-  }
-# endif /* !defined(SPS_OS_windows) */
-  return kNoError;
-}
-
-
-WindowsFrameInfo* LocalDebugInfoSymbolizer::FindWindowsFrameInfo(
-    const StackFrame* frame) {
-  // Not currently implemented, would require PDBSourceLineWriter to
-  // implement an API to return symbol data.
-  return NULL;
-}
-
-#if !defined(SPS_OS_windows)
-// Taken wholesale from source_line_resolver_base.cc
-bool ParseCFIRuleSet(const string& rule_set, CFIFrameInfo* frame_info) {
-  CFIFrameInfoParseHandler handler(frame_info);
-  CFIRuleParser parser(&handler);
-  return parser.Parse(rule_set);
-}
-
-static void ConvertCFI(const UniqueString* name, const Module::Expr& rule,
-                       CFIFrameInfo* frame_info) {
-  if (name == ustr__ZDcfa()) frame_info->SetCFARule(rule);
-  else if (name == ustr__ZDra()) frame_info->SetRARule(rule);
-  else frame_info->SetRegisterRule(name, rule);
-}
-
-
-static void ConvertCFI(const Module::RuleMap& rule_map,
-                       CFIFrameInfo* frame_info) {
-  for (Module::RuleMap::const_iterator it = rule_map.begin();
-       it != rule_map.end(); ++it) {
-    ConvertCFI(it->first, it->second, frame_info);
-  }
-}
-#endif
-
-CFIFrameInfo* LocalDebugInfoSymbolizer::FindCFIFrameInfo(
-    const StackFrame* frame) {
-#if defined(SPS_OS_windows)
-  return NULL;
-#else
-  if (!frame || !frame->module) return NULL;
-
-  SymbolMap::const_iterator it = symbols_.find(frame->module->code_file());
-  if (it == symbols_.end()) return NULL;
-
-  Module* module = it->second;
-  uint64_t address = frame->instruction - frame->module->base_address();
-  Module::StackFrameEntry* entry =
-      module->FindStackFrameEntryByAddress(address);
-  if (!entry)
-    return NULL;
-
-  //TODO: can we cache this data per-address? does that make sense?
-  // TODO: Maybe this should use google_breakpad::scoped_ptr, since we're in
-  // "namespace google_breakpad". Not using scoped_ptr currently, because its
-  // header triggers build warnings -- see bug 855010.
-  nsAutoPtr<CFIFrameInfo> rules(new CFIFrameInfo());
-  ConvertCFI(entry->initial_rules, rules);
-  for (Module::RuleChangeMap::const_iterator delta_it =
-           entry->rule_changes.begin();
-       delta_it != entry->rule_changes.end() && delta_it->first < address;
-       ++delta_it) {
-    ConvertCFI(delta_it->second, rules);
-  }
-  return rules.forget();
-#endif /* defined(SPS_OS_windows) */
-}
-
-}  // namespace google_breakpad
deleted file mode 100644
--- a/tools/profiler/gecko/local_debug_info_symbolizer.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef PROCESSOR_LOCAL_DEBUG_INFO_SYMBOLIZER_H_
-#define PROCESSOR_LOCAL_DEBUG_INFO_SYMBOLIZER_H_
-
-#include "google_breakpad/processor/stack_frame_symbolizer.h"
-
-#include <map>
-#include <vector>
-
-namespace google_breakpad {
-
-class Module;
-
-class LocalDebugInfoSymbolizer : public StackFrameSymbolizer {
- public:
-  using StackFrameSymbolizer::SymbolizerResult;
-  LocalDebugInfoSymbolizer(const std::vector<string>& debug_dirs) :
-      StackFrameSymbolizer(NULL, NULL),
-      debug_dirs_(debug_dirs) {}
-  virtual ~LocalDebugInfoSymbolizer();
-
-  virtual SymbolizerResult FillSourceLineInfo(const CodeModules* modules,
-                                              const SystemInfo* system_info,
-                                              StackFrame* stack_frame);
-
-  virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame);
-
-  virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame);
-
-  // Lie to the stackwalker to short-circuit stack-scanning heuristics.
-  virtual bool HasImplementation() { return false; }
-
- private:
-  typedef std::map<string, Module*> SymbolMap;
-  SymbolMap symbols_;
-  std::vector<string> debug_dirs_;
-};
-
-}  // namespace google_breakpad
-
-#endif  // PROCESSOR_LOCAL_DEBUG_INFO_SYMBOLIZER_H_
--- a/tools/profiler/moz.build
+++ b/tools/profiler/moz.build
@@ -40,45 +40,47 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']:
         'gecko/nsProfilerFactory.cpp',
         'gecko/nsProfilerStartParams.cpp',
         'gecko/ProfileGatherer.cpp',
         'gecko/ProfilerIOInterposeObserver.cpp',
         'gecko/SaveProfileTask.cpp',
         'gecko/ThreadResponsiveness.cpp',
     ]
 
-    # This file cannot be built in unified mode because of name clashes with mozglue headers on Android.
-    SOURCES += [
-        'gecko/local_debug_info_symbolizer.cc',
-    ]
-
     if CONFIG['OS_TARGET'] in ('Android', 'Linux'):
         UNIFIED_SOURCES += [
             'lul/AutoObjectMapper.cpp',
             'lul/LulCommon.cpp',
             'lul/LulDwarf.cpp',
             'lul/LulDwarfSummariser.cpp',
             'lul/LulElf.cpp',
             'lul/LulMain.cpp',
             'lul/platform-linux-lul.cpp',
         ]
         # These files cannot be built in unified mode because of name clashes with mozglue headers on Android.
         SOURCES += [
             'core/platform-linux.cc',
             'core/shared-libraries-linux.cc',
         ]
+        if not CONFIG['MOZ_CRASHREPORTER']:
+            SOURCES += [
+                '/toolkit/crashreporter/google-breakpad/src/common/linux/elfutils.cc',
+                '/toolkit/crashreporter/google-breakpad/src/common/linux/file_id.cc',
+                '/toolkit/crashreporter/google-breakpad/src/common/linux/guid_creator.cc',
+                '/toolkit/crashreporter/google-breakpad/src/common/linux/linux_libc_support.cc',
+                '/toolkit/crashreporter/google-breakpad/src/common/linux/memory_mapped_file.cc',
+            ]
         if CONFIG['CPU_ARCH'] == 'arm':
             SOURCES += [
                 'core/EHABIStackWalk.cpp',
             ]
     elif CONFIG['OS_TARGET'] == 'Darwin':
         UNIFIED_SOURCES += [
             'core/platform-macos.cc',
             'core/shared-libraries-macos.cc',
-            'core/shim_mac_dump_syms.mm',
         ]
     elif CONFIG['OS_TARGET'] == 'WINNT':
         SOURCES += [
             'core/IntelPowerGadget.cpp',
             'core/platform-win32.cc',
             'core/shared-libraries-win32.cc',
         ]
 
@@ -88,17 +90,21 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']:
         '/mozglue/linker',
         '/toolkit/crashreporter/google-breakpad/src',
         '/tools/profiler/core/',
         '/tools/profiler/gecko/',
         '/xpcom/base',
     ]
 
     # We need access to Breakpad's getcontext(3) which is suitable for Android
-    if CONFIG['OS_TARGET'] == 'Android':
+    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+        LOCAL_INCLUDES += [
+            '/toolkit/crashreporter/gonk-include',
+        ]
+    elif CONFIG['OS_TARGET'] == 'Android':
         LOCAL_INCLUDES += [
             '/toolkit/crashreporter/google-breakpad/src/common/android/include',
         ]
 
     if CONFIG['ANDROID_CPU_ARCH'] == 'armeabi':
         DEFINES['ARCH_ARMV6'] = True
 
     if CONFIG['ENABLE_TESTS']:
--- a/xpcom/threads/ThreadStackHelper.cpp
+++ b/xpcom/threads/ThreadStackHelper.cpp
@@ -31,22 +31,17 @@
 # include <valgrind/valgrind.h>
 #endif
 
 #include <string.h>
 #include <vector>
 #include <cstdlib>
 
 #ifdef XP_LINUX
-#ifdef ANDROID
-// Android NDK doesn't contain ucontext.h; use Breakpad's copy.
-# include "common/android/include/sys/ucontext.h"
-#else
-# include <ucontext.h>
-#endif
+#include <ucontext.h>
 #include <unistd.h>
 #include <sys/syscall.h>
 #endif
 
 #ifdef __GNUC__
 # pragma GCC diagnostic pop // -Wshadow
 #endif
 
--- a/xpcom/threads/moz.build
+++ b/xpcom/threads/moz.build
@@ -60,20 +60,26 @@ UNIFIED_SOURCES += [
     'TaskQueue.cpp',
     'ThreadStackHelper.cpp',
     'TimerThread.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '../build',
     '/caps',
-    '/toolkit/crashreporter/google-breakpad/src',
     '/tools/profiler',
 ]
 
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+    # Gonk's bionic doesn't have ucontext.h
+    LOCAL_INCLUDES += [
+        '/toolkit/crashreporter/gonk-include',
+    ]
+
+
 # BHR disabled for Release builds because of bug 965392.
 # BHR disabled for debug builds because of bug 979069.
 # BHR disabled on gonk because of bug 1180533
 # BHR disabled for TSan builds because of bug 1121216.
 if CONFIG['MOZ_UPDATE_CHANNEL'] not in ('release') and \
    not CONFIG['MOZ_DEBUG'] and \
    not CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and \
    not CONFIG['MOZ_TSAN']: