Bug 743306 - Part 1: On Android, log MOZ_Assert messages to logcat because stderr is directed to /dev/null. r=glandium

--HG--
extra : rebase_source : 1dda421f84116784539d6ca65fb1d9092506b0bd
This commit is contained in:
Chris Peterson 2012-04-09 12:45:17 -07:00
parent 8277a818e7
commit 43693c5ef7

View File

@ -47,6 +47,10 @@
#include <signal.h>
#endif
#ifdef ANDROID
#include <android/log.h>
#endif
/* Implementations of runtime and static assertion macros for C and C++. */
extern "C" {
@ -83,8 +87,13 @@ MOZ_Crash()
MOZ_EXPORT_API(void)
MOZ_Assert(const char* s, const char* file, int ln)
{
#ifdef ANDROID
__android_log_print(ANDROID_LOG_FATAL, "MOZ_Assert",
"Assertion failure: %s, at %s:%d\n", s, file, ln);
#else
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
fflush(stderr);
#endif
MOZ_Crash();
}