From 1e980b6bc8315d00a07312b25486531247abd98c Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 17 Jan 2013 18:36:06 -0800 Subject: Fix the duplication in the debugging code. We had two copies of the backtrace code, and two copies of the libcorkscrew /proc/pid/maps code. This patch gets us down to one. We also had hacks so we could log in the malloc debugging code. This patch pulls the non-allocating "printf" code out of the dynamic linker so everyone can share. This patch also makes the leak diagnostics easier to read, and makes it possible to paste them directly into the 'stack' tool (by using relative PCs). This patch also fixes the stdio standard stream leak that was causing a leak warning every time tf_daemon ran. Bug: 7291287 Change-Id: I66e4083ac2c5606c8d2737cb45c8ac8a32c7cfe8 --- linker/debugger.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'linker/debugger.cpp') diff --git a/linker/debugger.cpp b/linker/debugger.cpp index 5fd5cb73c..a14e30a8c 100644 --- a/linker/debugger.cpp +++ b/linker/debugger.cpp @@ -27,7 +27,6 @@ */ #include "linker.h" -#include "linker_format.h" #include #include @@ -38,6 +37,7 @@ #include #include +#include #include extern "C" int tgkill(int tgid, int tid, int sig); @@ -135,12 +135,12 @@ static void logSignalSummary(int signum, const siginfo_t* info) { char buffer[128]; // "info" will be NULL if the siginfo_t information was not available. if (info != NULL) { - format_buffer(buffer, sizeof(buffer), + __libc_format_buffer(buffer, sizeof(buffer), "Fatal signal %d (%s) at 0x%08x (code=%d), thread %d (%s)", signum, signame, reinterpret_cast(info->si_addr), info->si_code, gettid(), threadname); } else { - format_buffer(buffer, sizeof(buffer), + __libc_format_buffer(buffer, sizeof(buffer), "Fatal signal %d (%s), thread %d (%s)", signum, signame, gettid(), threadname); } @@ -215,7 +215,7 @@ void debugger_signal_handler(int n, siginfo_t* info, void*) { if (ret < 0) { /* read or write failed -- broken connection? */ - format_buffer(msgbuf, sizeof(msgbuf), + __libc_format_buffer(msgbuf, sizeof(msgbuf), "Failed while talking to debuggerd: %s", strerror(errno)); __libc_android_log_write(ANDROID_LOG_FATAL, "libc", msgbuf); } @@ -223,7 +223,7 @@ void debugger_signal_handler(int n, siginfo_t* info, void*) { close(s); } else { /* socket failed; maybe process ran out of fds */ - format_buffer(msgbuf, sizeof(msgbuf), + __libc_format_buffer(msgbuf, sizeof(msgbuf), "Unable to open connection to debuggerd: %s", strerror(errno)); __libc_android_log_write(ANDROID_LOG_FATAL, "libc", msgbuf); } -- cgit v1.2.3