From 465a5c3e9b85f9cab0c57310d49c0e12d4378f08 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Mon, 9 Apr 2012 12:45:17 -0700 Subject: [PATCH] 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 --- mfbt/Assertions.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mfbt/Assertions.cpp b/mfbt/Assertions.cpp index 5259eb7217d7..08a73af6d65c 100644 --- a/mfbt/Assertions.cpp +++ b/mfbt/Assertions.cpp @@ -47,6 +47,10 @@ #include #endif +#ifdef ANDROID +#include +#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(); }