Bug 1595629 - Note intentional crashes in NS_DEBUG_ABORT and nsTerminator. r=froydnj
authorAndrew McCreight <continuation@gmail.com>
Sat, 16 Nov 2019 01:38:22 +0000
changeset 502309 5258157edfeea095a4d96b65f819e2b6143af6c0
parent 502308 edafd8d2b8c67977bd4658891c1c7063ff9c5b83
child 502310 bf1d04bbfc0be1fc01828bf6c0a32a98473513d6
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1595629
milestone72.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 1595629 - Note intentional crashes in NS_DEBUG_ABORT and nsTerminator. r=froydnj This will prevent the leak checker from reporting a missing log for that process, which results in incorrect starring on TreeHerder. Both of these failures should be detected as a failure. Differential Revision: https://phabricator.services.mozilla.com/D53095
toolkit/components/terminator/nsTerminator.cpp
xpcom/base/nsDebugImpl.cpp
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -27,27 +27,29 @@
 #include "nsDirectoryServiceUtils.h"
 #include "nsAppDirectoryServiceDefs.h"
 
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
 #include "nsExceptionHandler.h"
 #include "GeckoProfiler.h"
 #include "nsThreadUtils.h"
+#include "nsXULAppAPI.h"
 
 #if defined(XP_WIN)
 #  include <windows.h>
 #else
 #  include <unistd.h>
 #endif
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/DebugOnly.h"
+#include "mozilla/IntentionalCrash.h"
 #include "mozilla/MemoryChecking.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Unused.h"
 #include "mozilla/Telemetry.h"
 
 #include "mozilla/dom/workerinternals/RuntimeService.h"
@@ -172,16 +174,18 @@ void RunWatchdog(void* arg) {
 #else
     usleep(1000000 /* usec */);
 #endif
 
     if (gHeartbeat++ < timeToLive) {
       continue;
     }
 
+    NoteIntentionalCrash(XRE_ChildProcessTypeToString(XRE_GetProcessType()));
+
     // The shutdown steps are not completed yet. Let's report the last one.
     if (!sShutdownNotified) {
       const char* lastStep = nullptr;
       for (size_t i = 0; i < ArrayLength(sShutdownSteps); ++i) {
         if (sShutdownSteps[i].mTicks == -1) {
           break;
         }
         lastStep = sShutdownSteps[i].mTopic;
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -3,16 +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/. */
 
 // Chromium headers must come before Mozilla headers.
 #include "base/process_util.h"
 
 #include "mozilla/Atomics.h"
+#include "mozilla/IntentionalCrash.h"
 #include "mozilla/Printf.h"
 
 #include "MainThreadUtils.h"
 #include "nsDebugImpl.h"
 #include "nsDebug.h"
 #include "nsExceptionHandler.h"
 #include "nsString.h"
 #include "nsXULAppAPI.h"
@@ -431,17 +432,20 @@ NS_DebugBreak(uint32_t aSeverity, const 
 
     case NS_ASSERT_TRAP:
     case NS_ASSERT_UNINITIALIZED:  // Default to "trap" behavior
       Break(buf.buffer);
       return;
   }
 }
 
-static void Abort(const char* aMsg) { mozalloc_abort(aMsg); }
+static void Abort(const char* aMsg) {
+  NoteIntentionalCrash(XRE_ChildProcessTypeToString(XRE_GetProcessType()));
+  mozalloc_abort(aMsg);
+}
 
 static void RealBreak() {
 #if defined(_WIN32)
   ::DebugBreak();
 #elif defined(XP_MACOSX)
   raise(SIGTRAP);
 #elif defined(__GNUC__) && \
     (defined(__i386__) || defined(__i386) || defined(__x86_64__))