Bug 824224: Make mozalloc_abort() not MOZ_NORETURN and log errors to logcat. r=glandium
authorChris Jones <jones.chris.g@gmail.com>
Fri, 04 Jan 2013 13:28:37 -0800
changeset 117677 496d7707ded1946539caabf2b60539e1325b242d
parent 117676 4fd475c2a94ad084162fd6ea82a95c3796fc8dbe
child 117678 5a7b468178a28e1bd2b761f8781414f9b7c0c940
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersglandium
bugs824224
milestone20.0a1
Bug 824224: Make mozalloc_abort() not MOZ_NORETURN and log errors to logcat. r=glandium
memory/mozalloc/mozalloc_abort.cpp
memory/mozalloc/mozalloc_abort.h
--- a/memory/mozalloc/mozalloc_abort.cpp
+++ b/memory/mozalloc/mozalloc_abort.cpp
@@ -4,27 +4,34 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #if defined(XP_WIN) || defined(XP_OS2)
 #  define MOZALLOC_EXPORT __declspec(dllexport)
 #endif
 
-#include "mozilla/Assertions.h"
+#include "mozilla/mozalloc_abort.h"
 
+#ifdef ANDROID
+# include <android/log.h>
+#endif
 #include <stdio.h>
 
-#include "mozilla/mozalloc_abort.h"
+#include "mozilla/Assertions.h"
 
 void
 mozalloc_abort(const char* const msg)
 {
+#ifndef ANDROID
     fputs(msg, stderr);
     fputs("\n", stderr);
+#else
+    __android_log_print(ANDROID_LOG_ERROR, "Gecko", "mozalloc_abort: %s", msg);
+#endif
     MOZ_CRASH();
 }
 
 #if defined(XP_UNIX)
 // Define abort() here, so that it is used instead of the system abort(). This
 // lets us control the behavior when aborting, in order to get better results
 // on *NIX platforms. See mozalloc_abort for details.
 void abort(void)
--- a/memory/mozalloc/mozalloc_abort.h
+++ b/memory/mozalloc/mozalloc_abort.h
@@ -22,12 +22,12 @@
 #else
 #  define MOZALLOC_EXPORT
 #endif
 
 /**
  * Terminate this process in such a way that breakpad is triggered, if
  * at all possible.
  */
-MOZ_NORETURN MOZALLOC_EXPORT void mozalloc_abort(const char* const msg);
+MOZALLOC_EXPORT void mozalloc_abort(const char* const msg);
 
 
 #endif  /* ifndef mozilla_mozalloc_abort_h */