mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1005730 - Print assertion stacks for MOZ_ASSERT and MOZ_CRASH for code that lives inside libxul; r=froydnj
The hyphenation changes are necessary because hnjalloc.h #defines FILE to a custom data structure, which clashes with using |stderr| in Assertions.h.
This commit is contained in:
parent
83c79d7b5b
commit
88fbe13b7d
@ -9,6 +9,7 @@
|
||||
// access the dictionary resources.
|
||||
|
||||
#include "hnjalloc.h"
|
||||
#undef FILE // Undo the damage done in hnjalloc.h
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
@ -5,12 +5,13 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'hnjstdio.cpp',
|
||||
'nsHyphenationManager.cpp',
|
||||
'nsHyphenator.cpp',
|
||||
]
|
||||
|
||||
# These files cannot be built in unified mode because they include hnjalloc.h.
|
||||
SOURCES += [
|
||||
'hnjstdio.cpp',
|
||||
'hyphen.c',
|
||||
]
|
||||
|
||||
|
@ -9,10 +9,17 @@
|
||||
#ifndef mozilla_Assertions_h
|
||||
#define mozilla_Assertions_h
|
||||
|
||||
#if defined(MOZILLA_INTERNAL_API) && defined(__cplusplus)
|
||||
#define MOZ_DUMP_ASSERTION_STACK
|
||||
#endif
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Compiler.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MacroArgs.h"
|
||||
#ifdef MOZ_DUMP_ASSERTION_STACK
|
||||
#include "nsTraceRefcnt.h"
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
@ -132,6 +139,9 @@ MOZ_ReportAssertionFailure(const char* s, const char* file, int ln)
|
||||
"Assertion failure: %s, at %s:%d\n", s, file, ln);
|
||||
#else
|
||||
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
|
||||
#ifdef MOZ_DUMP_ASSERTION_STACK
|
||||
nsTraceRefcnt::WalkTheStack(stderr);
|
||||
#endif
|
||||
fflush(stderr);
|
||||
#endif
|
||||
}
|
||||
@ -144,6 +154,9 @@ MOZ_ReportCrash(const char* s, const char* file, int ln)
|
||||
"Hit MOZ_CRASH(%s) at %s:%d\n", s, file, ln);
|
||||
#else
|
||||
fprintf(stderr, "Hit MOZ_CRASH(%s) at %s:%d\n", s, file, ln);
|
||||
#ifdef MOZ_DUMP_ASSERTION_STACK
|
||||
nsTraceRefcnt::WalkTheStack(stderr);
|
||||
#endif
|
||||
fflush(stderr);
|
||||
#endif
|
||||
}
|
||||
@ -484,4 +497,6 @@ void ValidateAssertConditionType()
|
||||
# define MOZ_ALWAYS_FALSE(expr) ((void)(expr))
|
||||
#endif
|
||||
|
||||
#undef MOZ_DUMP_ASSERTION_STACK
|
||||
|
||||
#endif /* mozilla_Assertions_h */
|
||||
|
Loading…
Reference in New Issue
Block a user