Bug 1333000 part 5 - Annotate crash reports with the value we found instead of the TI magic word. r=ehoogeveen

This commit is contained in:
Jan de Mooij 2017-02-05 21:24:23 +01:00
Родитель deffc9f665
Коммит 2cbdd72968
2 изменённых файлов: 24 добавлений и 2 удалений

Просмотреть файл

@ -7,6 +7,7 @@
#include "vm/TypeInference-inl.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
#include "mozilla/SizePrintfMacros.h"
@ -2606,6 +2607,20 @@ TypeZone::addPendingRecompile(JSContext* cx, JSScript* script)
ObjectStateChange(cx, script->functionNonDelazifying()->group(), false);
}
#ifdef JS_CRASH_DIAGNOSTICS
static char sCrashReason[256];
MOZ_NORETURN MOZ_COLD MOZ_NEVER_INLINE void
js::ReportMagicWordFailure(uintptr_t actual, uintptr_t expected)
{
SprintfLiteral(sCrashReason,
"MOZ_CRASH(Got 0x%" PRIxPTR " expected magic word 0x%" PRIxPTR ")",
actual, expected);
MOZ_CRASH_ANNOTATE(sCrashReason);
MOZ_REALLY_CRASH();
}
#endif
void
js::PrintTypes(JSContext* cx, JSCompartment* comp, bool force)
{

Просмотреть файл

@ -543,6 +543,11 @@ static const uintptr_t BaseTypeInferenceMagic = 0xa1a2b3b4c5c6d7d8;
static const uintptr_t TypeConstraintMagic = BaseTypeInferenceMagic + 1;
static const uintptr_t ConstraintTypeSetMagic = BaseTypeInferenceMagic + 2;
#ifdef JS_CRASH_DIAGNOSTICS
extern MOZ_NORETURN MOZ_COLD MOZ_NEVER_INLINE void
ReportMagicWordFailure(uintptr_t actual, uintptr_t expected);
#endif
/*
* A constraint which listens to additions to a type set and propagates those
* changes to other type sets.
@ -567,7 +572,8 @@ class TypeConstraint
void checkMagic() const {
#ifdef JS_CRASH_DIAGNOSTICS
MOZ_RELEASE_ASSERT(magic_ == TypeConstraintMagic);
if (MOZ_UNLIKELY(magic_ != TypeConstraintMagic))
ReportMagicWordFailure(magic_, TypeConstraintMagic);
#endif
}
@ -669,7 +675,8 @@ class ConstraintTypeSet : public TypeSet
void checkMagic() const {
#ifdef JS_CRASH_DIAGNOSTICS
MOZ_RELEASE_ASSERT(magic_ == ConstraintTypeSetMagic);
if (MOZ_UNLIKELY(magic_ != ConstraintTypeSetMagic))
ReportMagicWordFailure(magic_, ConstraintTypeSetMagic);
#endif
}