void
mozalloc_abort(const char* const msg)
{
    fputs(msg, stderr);
    fputs("\n", stderr);

#if defined(_MSC_VER)
    __debugbreak();
#elif defined(XP_WIN)
    DebugBreak();
#endif

    // On *NIX platforms the prefered way to abort is by touching bad memory,
    // since this generates a stack trace inside our own code (avoiding
    // problems with starting the trace inside libc, where we might not have
    // symbols and can get lost).

    TouchBadMemory();

    // If we haven't aborted yet, we can try to raise SIGABRT which might work
    // on some *NIXs, but not OS X (it doesn't trigger breakpad there).
    // Note that we don't call abort(), since raise is likelier to give us
    // useful stack data, and also since abort() is redirected to call this
    // function (see below).
#if defined(XP_UNIX) && !defined(XP_MACOSX)
    raise(SIGABRT);
#endif

    // Still haven't aborted?  Try _exit().
    _exit(127);
}
示例#2
0
void
mozalloc_abort(const char* const msg)
{
    fputs(msg, stderr);
    fputs("\n", stderr);

#if defined(XP_UNIX) && !defined(XP_MACOSX)
    abort();
#elif defined(_MSC_VER)
    __debugbreak();
#elif defined(XP_WIN)
    DebugBreak();
#endif
    // abort() doesn't trigger breakpad on Mac, "fall through" to the
    // fail-safe code

    // Still haven't aborted?  Try dereferencing null.
    TouchBadMemory();

    // Still haven't aborted?  Try _exit().
    _exit(127);
}