Bug 1166964 - Disable Breakpad INFO logging. r=ted
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 08 Jun 2015 13:04:04 -0500
changeset 247634 51e393cd5b5a1e3fa0f8007a50161fcc1a1f2a2d
parent 247633 4bc3d8e62192ea5ff9084681778e5e95648cfa48
child 247635 ab4fcd2c9ca6c7d2b4cb82109a0ce94fb3cef859
push id60763
push userjryans@gmail.com
push dateMon, 08 Jun 2015 18:04:16 +0000
treeherdermozilla-inbound@51e393cd5b5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1166964
milestone41.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 1166964 - Disable Breakpad INFO logging. r=ted
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/google-breakpad/src/common/moz.build
toolkit/crashreporter/google-breakpad/src/processor/moz.build
toolkit/crashreporter/moz.build
toolkit/moz.build
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/breakpad-logging/BreakpadLogging.cpp
@@ -0,0 +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/. */
+
+#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
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/breakpad-logging/BreakpadLogging.h
@@ -0,0 +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/. */
+
+#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
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/breakpad-logging/moz.build
@@ -0,0 +1,18 @@
+# -*- 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'
+
+FAIL_ON_WARNINGS = True
+
+with Files('**'):
+    BUG_COMPONENT = ('Toolkit', 'Breakpad Integration')
--- a/toolkit/crashreporter/client/moz.build
+++ b/toolkit/crashreporter/client/moz.build
@@ -37,16 +37,17 @@ 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/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -81,14 +81,16 @@ Library('breakpad_common_s')
 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
@@ -18,14 +18,17 @@ UNIFIED_SOURCES += [
     'stackwalker_ppc.cc',
     'stackwalker_sparc.cc',
     'stackwalker_x86.cc',
     'tokenize.cc',
 ]
 
 FINAL_LIBRARY = 'xul'
 
+DEFINES['BP_LOGGING_INCLUDE'] = '"BreakpadLogging.h"'
+
 LOCAL_INCLUDES += [
     '..',
     '../..',
+    '../../../breakpad-logging',
 ]
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/moz.build
+++ b/toolkit/crashreporter/moz.build
@@ -43,17 +43,20 @@ 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 += ['client']
+DIRS += [
+    'breakpad-logging',
+    'client',
+]
 
 if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
     DIRS += ['injector']
     UNIFIED_SOURCES += [
         'InjectCrashReporter.cpp',
         'LoadLibraryRemote.cpp',
     ]
 
--- a/toolkit/moz.build
+++ b/toolkit/moz.build
@@ -51,16 +51,17 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'an
     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']