diff options
author | Mark Salyzyn <salyzyn@google.com> | 2014-05-16 20:34:17 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-05-16 20:34:18 +0000 |
commit | bc741ac2126727d9de33042fa308307690efe13f (patch) | |
tree | 3367e9ae6e6ee506c01d18b3bd21d724ce94d204 /debuggerd | |
parent | 8b2d46a5fcbe81edde4b7c405916282a142a09d2 (diff) | |
parent | 989980c55d9a11766b8698a97ce5eef3d8cfa286 (diff) | |
download | system_core-bc741ac2126727d9de33042fa308307690efe13f.zip system_core-bc741ac2126727d9de33042fa308307690efe13f.tar.gz system_core-bc741ac2126727d9de33042fa308307690efe13f.tar.bz2 |
Merge "logd: logcat: debuggerd: auditd logs to events"
Diffstat (limited to 'debuggerd')
-rwxr-xr-x | debuggerd/tombstone.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp index d0cefc7..6d51171 100755 --- a/debuggerd/tombstone.cpp +++ b/debuggerd/tombstone.cpp @@ -31,9 +31,10 @@ #include <private/android_filesystem_config.h> +#include <cutils/properties.h> #include <log/log.h> #include <log/logger.h> -#include <cutils/properties.h> +#include <log/logprint.h> #include <backtrace/Backtrace.h> #include <backtrace/BacktraceMap.h> @@ -459,6 +460,8 @@ static bool dump_sibling_thread_report( // that don't match the specified pid, and writes them to the tombstone file. // // If "tail" is set, we only print the last few lines. +static EventTagMap* g_eventTagMap = NULL; + static void dump_log_file(log_t* log, pid_t pid, const char* filename, unsigned int tail) { bool first = true; @@ -521,7 +524,28 @@ static void dump_log_file(log_t* log, pid_t pid, const char* filename, if (!hdr_size) { hdr_size = sizeof(log_entry.entry_v1); } - char* msg = (char *)log_entry.buf + hdr_size; + char* msg = reinterpret_cast<char*>(log_entry.buf) + hdr_size; + + char timeBuf[32]; + time_t sec = static_cast<time_t>(entry->sec); + struct tm tmBuf; + struct tm* ptm; + ptm = localtime_r(&sec, &tmBuf); + strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", ptm); + + if (log_entry.id() == LOG_ID_EVENTS) { + if (!g_eventTagMap) { + g_eventTagMap = android_openEventTagMap(EVENT_TAG_MAP_FILE); + } + AndroidLogEntry e; + char buf[512]; + android_log_processBinaryLogBuffer(entry, &e, g_eventTagMap, buf, sizeof(buf)); + _LOG(log, 0, "%s.%03d %5d %5d %c %-8s: %s\n", + timeBuf, entry->nsec / 1000000, entry->pid, entry->tid, + 'I', e.tag, e.message); + continue; + } + unsigned char prio = msg[0]; char* tag = msg + 1; msg = tag + strlen(tag) + 1; @@ -534,13 +558,6 @@ static void dump_log_file(log_t* log, pid_t pid, const char* filename, char prioChar = (prio < strlen(kPrioChars) ? kPrioChars[prio] : '?'); - char timeBuf[32]; - time_t sec = static_cast<time_t>(entry->sec); - struct tm tmBuf; - struct tm* ptm; - ptm = localtime_r(&sec, &tmBuf); - strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", ptm); - // Look for line breaks ('\n') and display each text line // on a separate line, prefixed with the header, like logcat does. do { @@ -565,6 +582,7 @@ static void dump_log_file(log_t* log, pid_t pid, const char* filename, static void dump_logs(log_t* log, pid_t pid, unsigned tail) { dump_log_file(log, pid, "system", tail); dump_log_file(log, pid, "main", tail); + dump_log_file(log, pid, "events", tail); } static void dump_abort_message(Backtrace* backtrace, log_t* log, uintptr_t address) { |