diff options
Diffstat (limited to 'liblog/logd_write_kern.c')
-rw-r--r-- | liblog/logd_write_kern.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/liblog/logd_write_kern.c b/liblog/logd_write_kern.c index 5ef349b..8c707ad 100644 --- a/liblog/logd_write_kern.c +++ b/liblog/logd_write_kern.c @@ -93,6 +93,9 @@ static int __write_to_log_kernel(log_id_t log_id, struct iovec *vec, size_t nr) int log_fd; if (/*(int)log_id >= 0 &&*/ (int)log_id < (int)LOG_ID_MAX) { + if (log_id == LOG_ID_CRASH) { + log_id = LOG_ID_MAIN; + } log_fd = log_fds[(int)log_id]; } else { return -EBADF; @@ -269,9 +272,15 @@ 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 */ } int __android_log_bwrite(int32_t tag, const void *payload, size_t len) |