bug 534922: quick and dirty hack to make NS_RUNTIMEABORT trigger the crashreporter on windows. r=bsmedberg
authorChris Jones <jones.chris.g@gmail.com>
Tue, 15 Dec 2009 15:40:30 -0600
changeset 36275 e897841b4db68eb25a2ddae23c4bafe10174c0ed
parent 36274 d7bbac64b5f68d0adbd50700908bf965fc16ef9a
child 36276 6cd556b22e91811c40f301482ef1db249ea50b84
push id10758
push userbsmedberg@mozilla.com
push dateWed, 16 Dec 2009 14:23:28 +0000
treeherdermozilla-central@4eef63c0c6c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs534922
milestone1.9.3a1pre
bug 534922: quick and dirty hack to make NS_RUNTIMEABORT trigger the crashreporter on windows. r=bsmedberg
xpcom/base/nsDebugImpl.cpp
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -357,19 +357,28 @@ NS_DebugBreak(PRUint32 aSeverity, const 
      return;
 
    case NS_ASSERT_TRAP:
      Break(buf.buffer);
    }   
 }
 
 static void
+TouchBadMemory()
+{
+  // XXX this should use the frame poisoning code
+  gAssertionCount += *((PRInt32 *) 0); // TODO annotation saying we know 
+                                       // this is crazy
+}
+
+static void
 Abort(const char *aMsg)
 {
 #if defined(_WIN32)
+  TouchBadMemory();
 
 #ifndef WINCE
   //This should exit us
   raise(SIGABRT);
 #endif
   //If we are ignored exit this way..
   _exit(3);
 #elif defined(XP_UNIX)
@@ -381,19 +390,17 @@ Abort(const char *aMsg)
 #endif
   }
 #else
   // Don't know how to abort on this platform! call Break() instead
   Break(aMsg);
 #endif
 
   // Still haven't aborted?  Try dereferencing null.
-  // (Written this way to lessen the likelihood of it being optimized away.)
-  gAssertionCount += *((PRInt32 *) 0); // TODO annotation saying we know 
-                                       // this is crazy
+  TouchBadMemory();
 
   // Still haven't aborted?  Try _exit().
   PR_ProcessExit(127);
 }
 
 static void
 RealBreak()
 {