diff options
author | Elliott Hughes <enh@google.com> | 2014-04-23 14:52:49 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-04-23 14:52:49 -0700 |
commit | 2e3b7108b5b3d3f3a4a0fb369016e854bcf92212 (patch) | |
tree | 9c44095aed267fa12c51c2e8189e8cfc2a7ea542 /libc/bionic | |
parent | 3b0433f34fed755c28a92d46eab88729694b8055 (diff) | |
download | bionic-2e3b7108b5b3d3f3a4a0fb369016e854bcf92212.zip bionic-2e3b7108b5b3d3f3a4a0fb369016e854bcf92212.tar.gz bionic-2e3b7108b5b3d3f3a4a0fb369016e854bcf92212.tar.bz2 |
Allow liblog to pass failure reasons to debuggerd.
assert(3) already does this, but LOG_ALWAYS_FATAL and LOG_ALWAYS_FATAL_IF
have been missing out.
Change-Id: I1d6214c4f792fa0d4ba3c14eded3fc9c332bd3c5
Diffstat (limited to 'libc/bionic')
-rw-r--r-- | libc/bionic/libc_logging.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libc/bionic/libc_logging.cpp b/libc/bionic/libc_logging.cpp index 8e62e40..c9c5d28 100644 --- a/libc/bionic/libc_logging.cpp +++ b/libc/bionic/libc_logging.cpp @@ -614,7 +614,7 @@ void __fortify_chk_fail(const char* msg, uint32_t tag) { __libc_fatal("FORTIFY_SOURCE: %s. Calling abort().", msg); } -static void __libc_fatal(const char* format, va_list args) { +static void __libc_fatal(const char* tag, const char* format, va_list args) { char msg[1024]; BufferOutputStream os(msg, sizeof(msg)); out_vformat(os, format, args); @@ -622,7 +622,7 @@ static void __libc_fatal(const char* format, va_list args) { // TODO: log to stderr for the benefit of "adb shell" users. // Log to the log for the benefit of regular app developers (whose stdout and stderr are closed). - __libc_write_log(ANDROID_LOG_FATAL, "libc", msg); + __libc_write_log(ANDROID_LOG_FATAL, tag, msg); __libc_set_abort_message(msg); } @@ -630,14 +630,23 @@ static void __libc_fatal(const char* format, va_list args) { void __libc_fatal_no_abort(const char* format, ...) { va_list args; va_start(args, format); - __libc_fatal(format, args); + __libc_fatal("libc", format, args); va_end(args); } void __libc_fatal(const char* format, ...) { va_list args; va_start(args, format); - __libc_fatal(format, args); + __libc_fatal("libc", format, args); + va_end(args); + abort(); +} + +// This is used by liblog to implement LOG_ALWAYS_FATAL and LOG_ALWAYS_FATAL_IF. +void __android_fatal(const char* tag, const char* format, ...) { + va_list args; + va_start(args, format); + __libc_fatal(tag, format, args); va_end(args); abort(); } |