michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: sw=4 ts=4 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #if defined(XP_WIN) michael@0: # define MOZALLOC_EXPORT __declspec(dllexport) michael@0: #endif michael@0: michael@0: #include "mozilla/mozalloc_abort.h" michael@0: michael@0: #ifdef ANDROID michael@0: # include michael@0: #endif michael@0: #include michael@0: michael@0: #include "mozilla/Assertions.h" michael@0: michael@0: void michael@0: mozalloc_abort(const char* const msg) michael@0: { michael@0: #ifndef ANDROID michael@0: fputs(msg, stderr); michael@0: fputs("\n", stderr); michael@0: #else michael@0: __android_log_print(ANDROID_LOG_ERROR, "Gecko", "mozalloc_abort: %s", msg); michael@0: #endif michael@0: MOZ_CRASH(); michael@0: } michael@0: michael@0: #if defined(XP_UNIX) michael@0: // Define abort() here, so that it is used instead of the system abort(). This michael@0: // lets us control the behavior when aborting, in order to get better results michael@0: // on *NIX platforms. See mozalloc_abort for details. michael@0: void abort(void) michael@0: { michael@0: mozalloc_abort("Redirecting call to abort() to mozalloc_abort\n"); michael@0: } michael@0: #endif michael@0: