Bug 564185: Centralize the breakpad-triggering abort code in mozalloc and use |*NULL| to abort on mac, since abort() doesn't trigger breakpad. r=ted

This commit is contained in:
Chris Jones
2010-05-18 20:53:52 -05:00
parent 14e961558f
commit c991fe3d25
2 changed files with 16 additions and 54 deletions

View File

@@ -72,6 +72,8 @@
#include "nsString.h"
#endif
#include "mozilla/mozalloc_abort.h"
static void
Abort(const char *aMsg);
@@ -363,44 +365,10 @@ NS_DebugBreak(PRUint32 aSeverity, const char *aStr, const char *aExpr,
}
}
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)
PR_Abort();
#elif defined(XP_BEOS)
{
#ifndef DEBUG_cls
DEBUGGER(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.
TouchBadMemory();
// Still haven't aborted? Try _exit().
PR_ProcessExit(127);
mozalloc_abort(aMsg);
}
static void