Replace snprintf calls in linker.

When enabling debug malloc, the snprintf calls in the linker fails to
update the buffer.

The problem is that snprintf makes a call to pthread_getspecific that
returns a valid pointer, but the data it points to is zero. This should
never happen and causes the snprintf to stop and do nothing.

Temporarily replace snprintf with a different implementation to work
around this issue.

Bug: 16874447
Bug: 17302493

(cherry pick from commit 172955a4e3)

Change-Id: Idca9d417978403d61debfd0434aaa82fd770f33b
This commit is contained in:
Christopher Ferris
2014-08-26 20:48:11 -07:00
parent 4f8268e38f
commit 052fa3a34c
2 changed files with 17 additions and 3 deletions

View File

@@ -170,9 +170,9 @@ static void log_signal_summary(int signum, const siginfo_t* info) {
if (info != NULL) {
// For a rethrown signal, this si_code will be right and the one debuggerd shows will
// always be SI_TKILL.
snprintf(code_desc, sizeof(code_desc), ", code %d", info->si_code);
__libc_format_buffer(code_desc, sizeof(code_desc), ", code %d", info->si_code);
if (has_address) {
snprintf(addr_desc, sizeof(addr_desc), ", fault addr %p", info->si_addr);
__libc_format_buffer(addr_desc, sizeof(addr_desc), ", fault addr %p", info->si_addr);
}
}
__libc_format_log(ANDROID_LOG_FATAL, "libc",