aboutsummaryrefslogtreecommitdiffstats
path: root/linker/debugger.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-01-17 18:36:06 -0800
committerElliott Hughes <enh@google.com>2013-01-18 22:20:06 -0800
commit1e980b6bc8315d00a07312b25486531247abd98c (patch)
tree539f2c0c63fca27d5eb6ba184d658bb0e11a32d9 /linker/debugger.cpp
parente4ca88d9fa8757e4fb4056fcafa5bc15b406a2fd (diff)
downloadandroid_bionic-1e980b6bc8315d00a07312b25486531247abd98c.tar.gz
android_bionic-1e980b6bc8315d00a07312b25486531247abd98c.tar.bz2
android_bionic-1e980b6bc8315d00a07312b25486531247abd98c.zip
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
Diffstat (limited to 'linker/debugger.cpp')
-rw-r--r--linker/debugger.cpp10
1 files changed, 5 insertions, 5 deletions
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 <stdio.h>
#include <stdlib.h>
@@ -38,6 +37,7 @@
#include <sys/socket.h>
#include <sys/un.h>
+#include <private/debug_format.h>
#include <private/logd.h>
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<uintptr_t>(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);
}