From 0d787c1fa18c6a1f29ef9840e28a68cf077be1de Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 4 Apr 2013 13:46:46 -0700 Subject: Make abort messages available to debuggerd. This adds __libc_fatal, cleans up the internal logging code a bit more, and switches suitable callers over to __libc_fatal. In addition to logging, __libc_fatal stashes the message somewhere that the debuggerd signal handler can find it before calling abort. In the debuggerd signal handler, we pass this address to debuggerd so that it can come back with ptrace to read the message and present it to the user. Bug: 8531731 Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29 --- libc/bionic/dlmalloc.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'libc/bionic/dlmalloc.c') diff --git a/libc/bionic/dlmalloc.c b/libc/bionic/dlmalloc.c index cf09aacf0..51c62a707 100644 --- a/libc/bionic/dlmalloc.c +++ b/libc/bionic/dlmalloc.c @@ -16,15 +16,7 @@ #include "dlmalloc.h" -#include -#include -#include -#include -#include - -#include - -#include +#include "private/libc_logging.h" // Send dlmalloc errors to the log. static void __bionic_heap_corruption_error(const char* function); @@ -37,15 +29,12 @@ static void __bionic_heap_usage_error(const char* function, void* address); #include "../upstream-dlmalloc/malloc.c" static void __bionic_heap_corruption_error(const char* function) { - __libc_format_log(ANDROID_LOG_FATAL, "libc", "@@@ ABORTING: heap corruption detected by %s", - function); - abort(); + __libc_fatal("@@@ ABORTING: heap corruption detected by %s", function); } static void __bionic_heap_usage_error(const char* function, void* address) { - __libc_format_log(ANDROID_LOG_FATAL, "libc", - "@@@ ABORTING: invalid address or address of corrupt block %p passed to %s", - address, function); + __libc_fatal("@@@ ABORTING: invalid address or address of corrupt block %p passed to %s", + address, function); // So that we can get a memory dump around the specific address. *((int**) 0xdeadbaad) = (int*) address; } -- cgit v1.2.3