mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1496503 - Move MOZ_CrashOOL to Assertions.h. r=froydnj
Ideally, we'd want the function to stay in Assertions.cpp, but that's only part of MFBT proper, and that doesn't have access to WalkTheStack like MOZ_CRASH has from being in Assertion.h, when included from Gecko code. Moving WalkTheStack to mozglue, putting it close together with MozStackWalk would be prefered, but that causes problems linking MFBT tests (which don't have access to mozglue), and other things. Overall, this was too deep a rabbit hole, and moving MOZ_CrashOOL to Assertions.h is much simpler. Since it's essentially the same as MOZ_CRASH, except it allows non-literal strings, we can make it inlined, and leave it to the compiler to drop the filename argument when it's not used. Differential Revision: https://phabricator.services.mozilla.com/D11718 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
628363da33
commit
9ccfce71d6
@ -18,21 +18,6 @@ MOZ_BEGIN_EXTERN_C
|
||||
*/
|
||||
MFBT_DATA const char* gMozCrashReason = nullptr;
|
||||
|
||||
#ifndef DEBUG
|
||||
MFBT_API MOZ_COLD MOZ_NORETURN MOZ_NEVER_INLINE void
|
||||
MOZ_CrashOOL(int aLine, const char* aReason)
|
||||
#else
|
||||
MFBT_API MOZ_COLD MOZ_NORETURN MOZ_NEVER_INLINE void
|
||||
MOZ_CrashOOL(const char* aFilename, int aLine, const char* aReason)
|
||||
#endif
|
||||
{
|
||||
#ifdef DEBUG
|
||||
MOZ_ReportCrash(aReason, aFilename, aLine);
|
||||
#endif
|
||||
gMozCrashReason = aReason;
|
||||
MOZ_REALLY_CRASH(aLine);
|
||||
}
|
||||
|
||||
static char sPrintfCrashReason[sPrintfCrashReasonSize] = {};
|
||||
|
||||
// Accesses to this atomic are not included in web replay recordings, so that
|
||||
|
@ -301,15 +301,16 @@ MOZ_NoReturn(int aLine)
|
||||
* to crash-stats and are publicly visible. Firefox data stewards must do data
|
||||
* review on usages of this macro.
|
||||
*/
|
||||
#ifndef DEBUG
|
||||
MFBT_API MOZ_COLD MOZ_NORETURN MOZ_NEVER_INLINE void
|
||||
MOZ_CrashOOL(int aLine, const char* aReason);
|
||||
# define MOZ_CRASH_UNSAFE_OOL(reason) MOZ_CrashOOL(__LINE__, reason)
|
||||
#else
|
||||
MFBT_API MOZ_COLD MOZ_NORETURN MOZ_NEVER_INLINE void
|
||||
MOZ_CrashOOL(const char* aFilename, int aLine, const char* aReason);
|
||||
# define MOZ_CRASH_UNSAFE_OOL(reason) MOZ_CrashOOL(__FILE__, __LINE__, reason)
|
||||
static inline MOZ_COLD MOZ_NORETURN void
|
||||
MOZ_CrashOOL(const char* aFilename, int aLine, const char* aReason)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
MOZ_ReportCrash(aReason, aFilename, aLine);
|
||||
#endif
|
||||
MOZ_CRASH_ANNOTATE(aReason);
|
||||
MOZ_REALLY_CRASH(aLine);
|
||||
}
|
||||
#define MOZ_CRASH_UNSAFE_OOL(reason) MOZ_CrashOOL(__FILE__, __LINE__, reason)
|
||||
|
||||
static const size_t sPrintfMaxArgs = 4;
|
||||
static const size_t sPrintfCrashReasonSize = 1024;
|
||||
|
Loading…
Reference in New Issue
Block a user