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
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <private/debug_format.h>
|
||||
#include <private/logd.h>
|
||||
|
||||
// We log to stderr for the benefit of "adb shell" users, and the log for the benefit
|
||||
@@ -39,7 +40,7 @@
|
||||
|
||||
void __assert(const char* file, int line, const char* failed_expression) {
|
||||
const char* fmt = "%s:%d: assertion \"%s\" failed\n";
|
||||
__libc_android_log_print(ANDROID_LOG_FATAL, "libc", fmt, file, line, failed_expression);
|
||||
__libc_format_log(ANDROID_LOG_FATAL, "libc", fmt, file, line, failed_expression);
|
||||
fprintf(stderr, fmt, file, line, failed_expression);
|
||||
abort();
|
||||
/* NOTREACHED */
|
||||
@@ -47,7 +48,7 @@ void __assert(const char* file, int line, const char* failed_expression) {
|
||||
|
||||
void __assert2(const char* file, int line, const char* function, const char* failed_expression) {
|
||||
const char* fmt = "%s:%d: %s: assertion \"%s\" failed\n";
|
||||
__libc_android_log_print(ANDROID_LOG_FATAL, "libc", fmt, file, line, function, failed_expression);
|
||||
__libc_format_log(ANDROID_LOG_FATAL, "libc", fmt, file, line, function, failed_expression);
|
||||
fprintf(stderr, fmt, file, line, function, failed_expression);
|
||||
abort();
|
||||
/* NOTREACHED */
|
||||
|
||||
Reference in New Issue
Block a user