Bug 940821 - Build crashreporter in unified mode; r=ted
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 13 Dec 2013 09:55:39 -0500
changeset 160340 94c2cc05679453898d8104e9052dd3b83e050875
parent 160339 a5f9dee7531e8b725401c538472ff6abe3b63690
child 160341 97feecba44a48a1d5b8aa48a19242f82a19840b9
push id37567
push usereakhgari@mozilla.com
push dateFri, 13 Dec 2013 14:55:50 +0000
treeherdermozilla-inbound@94c2cc056794 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs940821
milestone29.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 940821 - Build crashreporter in unified mode; r=ted
toolkit/crashreporter/InjectCrashReporter.h
toolkit/crashreporter/client/crashreporter.cpp
toolkit/crashreporter/client/crashreporter_win.cpp
toolkit/crashreporter/client/moz.build
toolkit/crashreporter/google-breakpad/src/client/linux/crash_generation/moz.build
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/mac/crash_generation/moz.build
toolkit/crashreporter/google-breakpad/src/client/mac/handler/moz.build
toolkit/crashreporter/google-breakpad/src/common/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/common/solaris/moz.build
toolkit/crashreporter/google-breakpad/src/processor/moz.build
toolkit/crashreporter/moz.build
toolkit/crashreporter/test/moz.build
--- a/toolkit/crashreporter/InjectCrashReporter.h
+++ b/toolkit/crashreporter/InjectCrashReporter.h
@@ -1,13 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; 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 InjectCrashReporter_h
+#define InjectCrashReporter_h
+
 #include "nsThreadUtils.h"
 #include <windows.h>
 
 namespace mozilla {
 
 class InjectCrashRunnable : public nsRunnable
 {
 public:
@@ -16,8 +19,10 @@ public:
   NS_IMETHOD Run();
 
 private:
   DWORD mPID;
   nsString mInjectorPath;
 };
   
 } // Namespace mozilla
+
+#endif
--- a/toolkit/crashreporter/client/crashreporter.cpp
+++ b/toolkit/crashreporter/client/crashreporter.cpp
@@ -31,17 +31,17 @@ using std::auto_ptr;
 namespace CrashReporter {
 
 StringTable  gStrings;
 string       gSettingsPath;
 int          gArgc;
 char**       gArgv;
 
 static auto_ptr<ofstream> gLogStream(nullptr);
-static string             gDumpFile;
+static string             gReporterDumpFile;
 static string             gExtraFile;
 
 static string kExtraDataExtension = ".extra";
 
 void UIError(const string& message)
 {
   string errorMessage;
   if (!gStrings[ST_CRASHREPORTERERROR].empty()) {
@@ -318,31 +318,31 @@ static bool AddSubmittedReport(const str
 
   return true;
 }
 
 void DeleteDump()
 {
   const char* noDelete = getenv("MOZ_CRASHREPORTER_NO_DELETE_DUMP");
   if (!noDelete || *noDelete == '\0') {
-    if (!gDumpFile.empty())
-      UIDeleteFile(gDumpFile);
+    if (!gReporterDumpFile.empty())
+      UIDeleteFile(gReporterDumpFile);
     if (!gExtraFile.empty())
       UIDeleteFile(gExtraFile);
   }
 }
 
 void SendCompleted(bool success, const string& serverResponse)
 {
   if (success) {
     if (AddSubmittedReport(serverResponse)) {
       DeleteDump();
     }
     else {
-      string directory = gDumpFile;
+      string directory = gReporterDumpFile;
       int slashpos = directory.find_last_of("/\\");
       if (slashpos < 2)
         return;
       directory.resize(slashpos);
       UIPruneSavedDumps(directory);
     }
   }
 }
@@ -441,24 +441,24 @@ int main(int argc, char** argv)
     UIError("Couldn't read configuration.");
     return 0;
   }
 
   if (!UIInit())
     return 0;
 
   if (argc > 1) {
-    gDumpFile = argv[1];
+    gReporterDumpFile = argv[1];
   }
 
-  if (gDumpFile.empty()) {
+  if (gReporterDumpFile.empty()) {
     // no dump file specified, run the default UI
     UIShowDefaultUI();
   } else {
-    gExtraFile = GetExtraDataFilename(gDumpFile);
+    gExtraFile = GetExtraDataFilename(gReporterDumpFile);
     if (gExtraFile.empty()) {
       UIError(gStrings[ST_ERROR_BADARGUMENTS]);
       return 0;
     }
 
     if (!UIFileExists(gExtraFile)) {
       UIError(gStrings[ST_ERROR_EXTRAFILEEXISTS]);
       return 0;
@@ -509,23 +509,23 @@ int main(int argc, char** argv)
 
     if (gSettingsPath.empty() || !UIEnsurePathExists(gSettingsPath)) {
       UIError(gStrings[ST_ERROR_NOSETTINGSPATH]);
       return 0;
     }
 
     OpenLogFile();
 
-    if (!UIFileExists(gDumpFile)) {
+    if (!UIFileExists(gReporterDumpFile)) {
       UIError(gStrings[ST_ERROR_DUMPFILEEXISTS]);
       return 0;
     }
 
     string pendingDir = gSettingsPath + UI_DIR_SEPARATOR + "pending";
-    if (!MoveCrashData(pendingDir, gDumpFile, gExtraFile)) {
+    if (!MoveCrashData(pendingDir, gReporterDumpFile, gExtraFile)) {
       return 0;
     }
 
     string sendURL = queryParameters["ServerURL"];
     // we don't need to actually send this
     queryParameters.erase("ServerURL");
 
     queryParameters["Throttleable"] = "1";
@@ -570,17 +570,17 @@ int main(int argc, char** argv)
      // see if this version has been end-of-lifed
      if (queryParameters.find("Version") != queryParameters.end() &&
          CheckEndOfLifed(queryParameters["Version"])) {
        UIError(gStrings[ST_ERROR_ENDOFLIFE]);
        DeleteDump();
        return 0;
      }
 
-    if (!UIShowCrashUI(gDumpFile, queryParameters, sendURL, restartArgs))
+    if (!UIShowCrashUI(gReporterDumpFile, queryParameters, sendURL, restartArgs))
       DeleteDump();
   }
 
   UIShutdown();
 
   return 0;
 }
 
--- a/toolkit/crashreporter/client/crashreporter_win.cpp
+++ b/toolkit/crashreporter/client/crashreporter_win.cpp
@@ -30,16 +30,20 @@
 #define SUBMIT_REPORT_OLD    L"SubmitReport"
 #define INCLUDE_URL_VALUE    L"IncludeURL"
 #define EMAIL_ME_VALUE       L"EmailMe"
 #define EMAIL_VALUE          L"Email"
 #define MAX_EMAIL_LENGTH     1024
 
 #define WM_UPLOADCOMPLETE WM_APP
 
+// Thanks, Windows.h :(
+#undef min
+#undef max
+
 using std::string;
 using std::wstring;
 using std::map;
 using std::vector;
 using std::set;
 using std::ios;
 using std::ifstream;
 using std::ofstream;
--- a/toolkit/crashreporter/client/moz.build
+++ b/toolkit/crashreporter/client/moz.build
@@ -3,39 +3,39 @@
 # 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['OS_TARGET'] != 'Android':
     PROGRAM = 'crashreporter'
 # The xpcshell test case here verifies that the CA certificate list
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'crashreporter.cpp',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'crashreporter_win.cpp',
     ]
     DEFINES['UNICODE'] = True
     DEFINES['_UNICODE'] = True
 elif CONFIG['OS_ARCH'] == 'Darwin':
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'crashreporter_unix_common.cpp',
     ]
 elif CONFIG['OS_ARCH'] == 'SunOS':
     SOURCES += [
         'crashreporter_linux.cpp',
         'crashreporter_unix.cpp',
     ]
 
 if CONFIG['MOZ_ENABLE_GTK']:
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'crashreporter_gtk_common.cpp',
         'crashreporter_linux.cpp',
         'crashreporter_unix_common.cpp'
         ]
 
 if CONFIG['OS_ARCH'] == 'Darwin':
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'crashreporter_osx.mm',
     ]
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/crash_generation/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/client/linux/crash_generation/moz.build
@@ -1,12 +1,12 @@
 # -*- 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/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'crash_generation_client.cc',
     'crash_generation_server.cc',
 ]
 
 FINAL_LIBRARY = 'xulapp_s'
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/moz.build
@@ -1,15 +1,15 @@
 # -*- 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/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     '../log/log.cc',
     'exception_handler.cc',
     'minidump_descriptor.cc',
 ]
 
 XPI_NAME = 'crashreporter'
 
 FINAL_LIBRARY = 'xulapp_s'
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/moz.build
@@ -1,15 +1,15 @@
 # -*- 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/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'linux_dumper.cc',
     'linux_ptrace_dumper.cc',
     'minidump_writer.cc',
 ]
 
 XPI_NAME = 'crashreporter'
 
 FINAL_LIBRARY = 'xulapp_s'
--- a/toolkit/crashreporter/google-breakpad/src/client/mac/crash_generation/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/crash_generation/moz.build
@@ -1,14 +1,14 @@
 # -*- 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/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'crash_generation_client.cc',
     'crash_generation_server.cc',
 ]
 
 XPI_NAME = 'crashreporter'
 
 FINAL_LIBRARY = 'xulapp_s'
--- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/moz.build
@@ -1,15 +1,15 @@
 # -*- 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/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'breakpad_nlist_64.cc',
     'dynamic_images.cc',
     'exception_handler.cc',
     'minidump_generator.cc',
 ]
 
 XPI_NAME = 'crashreporter'
 
--- a/toolkit/crashreporter/google-breakpad/src/common/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/common/Makefile.in
@@ -20,15 +20,8 @@ HOST_CXXFLAGS += -DHAVE_A_OUT_H
 OS_CXXFLAGS += -DHAVE_A_OUT_H
 endif
 ifeq (Darwin,$(OS_ARCH))
 HOST_CXXFLAGS += -DHAVE_MACH_O_NLIST_H
 OS_CXXFLAGS += -DHAVE_MACH_O_NLIST_H
 endif
 
 include $(topsrcdir)/config/rules.mk
-
-ifneq (WINNT,$(OS_TARGET))
-# Headers from this directory are included as "common/header.h". Having
-# -I$(srcdir) on the command line makes us use common/memory.h when
-# <memory.h> is included from system headers, which is not intended.
-INCLUDES = $(LOCAL_INCLUDES) -I$(DIST)/include
-endif
--- a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
@@ -1,25 +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/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'elfutils.cc',
-    'file_id.cc',
     'guid_creator.cc',
     'linux_libc_support.cc',
     'memory_mapped_file.cc',
     'safe_readlink.cc',
 ]
 
+# file_id.cc cannot be built in unified mode because it uses a custom STL_FLAGS
+SOURCES += [
+    'file_id.cc',
+]
+
 if CONFIG['OS_TARGET'] != 'Android':
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'http_upload.cc',
     ]
 
 if CONFIG['MOZ_CRASHREPORTER']:
     HOST_LIBRARY_NAME = 'host_breakpad_linux_common_s'
     HOST_SOURCES += [
         'dump_symbols.cc',
         'elf_symbols_to_module.cc',
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
@@ -1,30 +1,30 @@
 # -*- 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/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'arch_utilities.cc',
     'bootstrap_compat.cc',
     'file_id.cc',
     'macho_id.cc',
     'macho_reader.cc',
     'macho_utilities.cc',
     'macho_walker.cc',
     'string_utilities.cc',
 ]
 
 # This is a little weird, but we're building a host and a target lib here.
 # The host lib is used for dump_syms, and the target lib for the
 # crash reporter client.  Therefore, we don't need all the srcs in both.
 if CONFIG['MOZ_CRASHREPORTER']:
-    HOST_SOURCES += SOURCES
+    HOST_SOURCES += UNIFIED_SOURCES
     HOST_SOURCES += [
         'dump_syms.mm',
     ]
     HOST_LIBRARY_NAME = 'host_breakpad_mac_common_s'
 
 SOURCES += [
     'HTTPMultipartUpload.m',
     'MachIPC.mm',
--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -2,53 +2,50 @@
 # 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['OS_ARCH'] in ('Darwin', 'Linux'):
     DIRS += ['dwarf']
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'convert_UTF.c',
-]
-
-SOURCES += [
     'logging.cc',
     'module.cc',
     'pathname_stripper.cc',
     'string_conversion.cc',
     'unique_string.cc',
 ]
 
 if CONFIG['OS_TARGET'] != 'WINNT':
-    SOURCES += [
+    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':
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'linux/dump_symbols.cc',
         'linux/elf_symbols_to_module.cc',
     ]
 
 if CONFIG['OS_TARGET'] == 'Android':
     pass
 else:
     if CONFIG['OS_TARGET'] != 'WINNT':
-        SOURCES += [
+        UNIFIED_SOURCES += [
             'stabs_reader.cc',
             'stabs_to_module.cc',
         ]
 
 if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_CRASHREPORTER']:
     HOST_SOURCES += [ 'convert_UTF.c' ]
     HOST_LIBRARY_NAME = 'host_breakpad_common_s'
     HOST_SOURCES += [
@@ -64,21 +61,22 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CO
         'pathname_stripper.cc',
         'stabs_reader.cc',
         'stabs_to_module.cc',
         'string_conversion.cc',
         'unique_string.cc',
     ]
 
 if CONFIG['OS_ARCH'] == 'Darwin':
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'mac/dump_syms.mm',
     ]
 
 if CONFIG['OS_TARGET'] == 'Android':
+    # We don't support unifying assembly files.
     SOURCES += [
         'android/breakpad_getcontext.S',
     ]
 
 LIBRARY_NAME = 'breakpad_common_s'
 
 MSVC_ENABLE_PGO = True
 
--- a/toolkit/crashreporter/google-breakpad/src/common/solaris/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/solaris/moz.build
@@ -1,15 +1,15 @@
 # -*- 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/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'dump_symbols.cc',
     'file_id.cc',
     'guid_creator.cc',
 ]
 
 HOST_LIBRARY_NAME = 'host_breakpad_solaris_common_s'
 
 LIBRARY_NAME = 'breakpad_solaris_common_s'
--- a/toolkit/crashreporter/google-breakpad/src/processor/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/processor/moz.build
@@ -1,15 +1,15 @@
 # -*- 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/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'basic_code_modules.cc',
     'basic_source_line_resolver.cc',
     'call_stack.cc',
     'cfi_frame_info.cc',
     'minidump.cc',
     'source_line_resolver_base.cc',
     'stack_frame_symbolizer.cc',
     'stackwalker.cc',
--- a/toolkit/crashreporter/moz.build
+++ b/toolkit/crashreporter/moz.build
@@ -45,33 +45,33 @@ elif CONFIG['OS_ARCH'] == 'SunOS':
         'google-breakpad/src/client/solaris/handler',
         'google-breakpad/src/tools/solaris/dump_syms',
     ]
 
 DIRS += ['client']
 
 if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
     DIRS += ['injector']
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'InjectCrashReporter.cpp',
         'LoadLibraryRemote.cpp',
     ]
 
 TEST_TOOL_DIRS += ['test']
 
 EXPORTS += [
     'nsExceptionHandler.h',
 ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'nsExceptionHandler.cpp',
 ]
 
 if CONFIG['OS_ARCH'] == 'Darwin':
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'mac_utils.mm',
     ]
 
 EXTRA_JS_MODULES += [
     'CrashReports.jsm',
     'CrashSubmit.jsm',
     'KeyValueParser.jsm',
 ]
--- a/toolkit/crashreporter/test/moz.build
+++ b/toolkit/crashreporter/test/moz.build
@@ -3,17 +3,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/.
 NO_DIST_INSTALL = True
 
 XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini', 'unit_ipc/xpcshell.ini']
 BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
 
-SOURCES += [
+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/minidump.cc',
     'dumputils.cpp',
     'nsTestCrasher.cpp',
 ]