summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-05-07 04:04:38 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-05-07 04:04:39 +0000
commit2c55b454c7a9df44ebd6128a2951187be4971702 (patch)
tree1d5600c49da88e9506e42ed1b900e8d16d0f69e4
parent66e952e254c9bda46d5ef9614027b18d0a7a6c8e (diff)
parent26864bf9cbe49892faa3a4ffd7a3cef00fa8850e (diff)
downloadcore-2c55b454c7a9df44ebd6128a2951187be4971702.tar.gz
core-2c55b454c7a9df44ebd6128a2951187be4971702.tar.bz2
core-2c55b454c7a9df44ebd6128a2951187be4971702.zip
Merge "Switch to the new bionic fatal logging interface."
-rw-r--r--liblog/logd_write.c13
-rw-r--r--liblog/logd_write_kern.c13
2 files changed, 14 insertions, 12 deletions
diff --git a/liblog/logd_write.c b/liblog/logd_write.c
index bd36a65c6..4c47382e2 100644
--- a/liblog/logd_write.c
+++ b/liblog/logd_write.c
@@ -323,6 +323,13 @@ int __android_log_write(int prio, const char *tag, const char *msg)
tag = tmp_tag;
}
+#if __BIONIC__
+ if (prio == ANDROID_LOG_FATAL) {
+ extern void __android_set_abort_message(const char*);
+ __android_set_abort_message(msg);
+ }
+#endif
+
vec[0].iov_base = (unsigned char *) &prio;
vec[0].iov_len = 1;
vec[1].iov_base = (void *) tag;
@@ -422,14 +429,8 @@ void __android_log_assert(const char *cond, const char *tag,
strcpy(buf, "Unspecified assertion failed");
}
-#if __BIONIC__
- // Ensure debuggerd gets to see what went wrong by keeping the C library in the loop.
- extern __noreturn void __android_fatal(const char* tag, const char* format, ...) __printflike(2, 3);
- __android_fatal(tag ? tag : "", "%s", buf);
-#else
__android_log_write(ANDROID_LOG_FATAL, tag, buf);
__builtin_trap(); /* trap so we have a chance to debug the situation */
-#endif
/* NOTREACHED */
}
diff --git a/liblog/logd_write_kern.c b/liblog/logd_write_kern.c
index 8c707adfb..982beaaed 100644
--- a/liblog/logd_write_kern.c
+++ b/liblog/logd_write_kern.c
@@ -173,6 +173,13 @@ int __android_log_write(int prio, const char *tag, const char *msg)
tag = tmp_tag;
}
+#if __BIONIC__
+ if (prio == ANDROID_LOG_FATAL) {
+ extern void __android_set_abort_message(const char*);
+ __android_set_abort_message(msg);
+ }
+#endif
+
vec[0].iov_base = (unsigned char *) &prio;
vec[0].iov_len = 1;
vec[1].iov_base = (void *) tag;
@@ -272,14 +279,8 @@ void __android_log_assert(const char *cond, const char *tag,
strcpy(buf, "Unspecified assertion failed");
}
-#if __BIONIC__
- // Ensure debuggerd gets to see what went wrong by keeping the C library in the loop.
- extern __noreturn void __android_fatal(const char* tag, const char* format, ...) __printflike(2, 3);
- __android_fatal(tag ? tag : "", "%s", buf);
-#else
__android_log_write(ANDROID_LOG_FATAL, tag, buf);
__builtin_trap(); /* trap so we have a chance to debug the situation */
-#endif
/* NOTREACHED */
}