Merge "debuggerd: synchronize cosmetics to internal"
This commit is contained in:
commit
0a350f4f08
1 changed files with 9 additions and 13 deletions
|
|
@ -438,16 +438,16 @@ static bool dump_sibling_thread_report(
|
||||||
// Reads the contents of the specified log device, filters out the entries
|
// Reads the contents of the specified log device, filters out the entries
|
||||||
// that don't match the specified pid, and writes them to the tombstone file.
|
// 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.
|
// If "tail" is non-zero, log the last "tail" number of lines.
|
||||||
static EventTagMap* g_eventTagMap = NULL;
|
static EventTagMap* g_eventTagMap = NULL;
|
||||||
|
|
||||||
static void dump_log_file(log_t* log, pid_t pid, const char* filename,
|
static void dump_log_file(
|
||||||
unsigned int tail) {
|
log_t* log, pid_t pid, const char* filename, unsigned int tail) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
struct logger_list *logger_list;
|
struct logger_list* logger_list;
|
||||||
|
|
||||||
logger_list = android_logger_list_open(
|
logger_list = android_logger_list_open(
|
||||||
android_name_to_log_id(filename), O_RDONLY | O_NONBLOCK, tail, pid);
|
android_name_to_log_id(filename), O_RDONLY | O_NONBLOCK, tail, pid);
|
||||||
|
|
||||||
if (!logger_list) {
|
if (!logger_list) {
|
||||||
ALOGE("Unable to open %s: %s\n", filename, strerror(errno));
|
ALOGE("Unable to open %s: %s\n", filename, strerror(errno));
|
||||||
|
|
@ -458,6 +458,7 @@ static void dump_log_file(log_t* log, pid_t pid, const char* filename,
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
ssize_t actual = android_logger_list_read(logger_list, &log_entry);
|
ssize_t actual = android_logger_list_read(logger_list, &log_entry);
|
||||||
|
struct logger_entry* entry;
|
||||||
|
|
||||||
if (actual < 0) {
|
if (actual < 0) {
|
||||||
if (actual == -EINTR) {
|
if (actual == -EINTR) {
|
||||||
|
|
@ -481,12 +482,8 @@ static void dump_log_file(log_t* log, pid_t pid, const char* filename,
|
||||||
// because you will be writing as fast as you're reading. Any
|
// because you will be writing as fast as you're reading. Any
|
||||||
// high-frequency debug diagnostics should just be written to
|
// high-frequency debug diagnostics should just be written to
|
||||||
// the tombstone file.
|
// the tombstone file.
|
||||||
struct logger_entry* entry = &log_entry.entry_v1;
|
|
||||||
|
|
||||||
if (entry->pid != static_cast<int32_t>(pid)) {
|
entry = &log_entry.entry_v1;
|
||||||
// wrong pid, ignore
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
_LOG(log, logtype::LOGS, "--------- %slog %s\n",
|
_LOG(log, logtype::LOGS, "--------- %slog %s\n",
|
||||||
|
|
@ -532,7 +529,7 @@ static void dump_log_file(log_t* log, pid_t pid, const char* filename,
|
||||||
// consume any trailing newlines
|
// consume any trailing newlines
|
||||||
char* nl = msg + strlen(msg) - 1;
|
char* nl = msg + strlen(msg) - 1;
|
||||||
while (nl >= msg && *nl == '\n') {
|
while (nl >= msg && *nl == '\n') {
|
||||||
*nl-- = '\0';
|
*nl-- = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
char prioChar = (prio < strlen(kPrioChars) ? kPrioChars[prio] : '?');
|
char prioChar = (prio < strlen(kPrioChars) ? kPrioChars[prio] : '?');
|
||||||
|
|
@ -549,7 +546,6 @@ static void dump_log_file(log_t* log, pid_t pid, const char* filename,
|
||||||
_LOG(log, logtype::LOGS, "%s.%03d %5d %5d %c %-8s: %s\n",
|
_LOG(log, logtype::LOGS, "%s.%03d %5d %5d %c %-8s: %s\n",
|
||||||
timeBuf, entry->nsec / 1000000, entry->pid, entry->tid,
|
timeBuf, entry->nsec / 1000000, entry->pid, entry->tid,
|
||||||
prioChar, tag, msg);
|
prioChar, tag, msg);
|
||||||
|
|
||||||
} while ((msg = nl));
|
} while ((msg = nl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -558,7 +554,7 @@ static void dump_log_file(log_t* log, pid_t pid, const char* filename,
|
||||||
|
|
||||||
// Dumps the logs generated by the specified pid to the tombstone, from both
|
// Dumps the logs generated by the specified pid to the tombstone, from both
|
||||||
// "system" and "main" log devices. Ideally we'd interleave the output.
|
// "system" and "main" log devices. Ideally we'd interleave the output.
|
||||||
static void dump_logs(log_t* log, pid_t pid, unsigned tail) {
|
static void dump_logs(log_t* log, pid_t pid, unsigned int tail) {
|
||||||
dump_log_file(log, pid, "system", tail);
|
dump_log_file(log, pid, "system", tail);
|
||||||
dump_log_file(log, pid, "main", tail);
|
dump_log_file(log, pid, "main", tail);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue