Home | History | Annotate | Download | only in debuggerd

Lines Matching refs:log

32 #include <log/logger.h>
160 static void dump_revision_info(log_t* log)
166 _LOG(log, SCOPE_AT_FAULT, "Revision: '%s'\n", revision);
169 static void dump_build_info(log_t* log)
175 _LOG(log, SCOPE_AT_FAULT, "Build fingerprint: '%s'\n", fingerprint);
178 static void dump_fault_addr(log_t* log, pid_t tid, int sig)
184 _LOG(log, SCOPE_AT_FAULT, "cannot get siginfo: %s\n", strerror(errno));
186 _LOG(log, SCOPE_AT_FAULT, "signal %d (%s), code %d (%s), fault addr %08x\n",
191 _LOG(log, SCOPE_AT_FAULT, "signal %d (%s), code %d (%s), fault addr --------\n",
196 static void dump_thread_info(log_t* log, pid_t pid, pid_t tid, bool at_fault) {
224 _LOG(log, SCOPE_AT_FAULT, "pid: %d, tid: %d, name: %s >>> %s <<<\n", pid, tid,
228 _LOG(log, 0, "pid: %d, tid: %d, name: %s\n",
234 log_t* log, pid_t tid __attribute((unused)), bool at_fault,
237 _LOG(log, scopeFlags, "\nbacktrace:\n");
245 _LOG(log, scopeFlags, " %s\n", line);
250 static void dump_stack_segment(const ptrace_context_t* context, log_t* log, pid_t tid,
268 _LOG(log, scopeFlags, " #%02d %08x %08x %s (%s+%u)\n",
271 _LOG(log, scopeFlags, " #%02d %08x %08x %s (%s)\n",
276 _LOG(log, scopeFlags, " %08x %08x %s (%s+%u)\n",
279 _LOG(log, scopeFlags, " %08x %08x %s (%s)\n",
286 _LOG(log, scopeFlags, " #%02d %08x %08x %s\n",
289 _LOG(log, scopeFlags, " %08x %08x %s\n",
298 static void dump_stack(const ptrace_context_t* context, log_t* log, pid_t tid, bool at_fault,
316 _LOG(log, scopeFlags, "\nstack:\n");
320 dump_stack_segment(context, log, tid, scopeFlags, &sp, STACK_WORDS, -1);
323 // Only log the first 3 frames, put the rest in the tombstone.
327 _LOG(log, scopeFlags, " ........ ........\n");
334 dump_stack_segment(context, log, tid, scopeFlags, &sp, STACK_WORDS, i);
336 _LOG(log, scopeFlags, " ........ ........\n");
345 dump_stack_segment(context, log, tid, scopeFlags, &sp, words, i);
350 static void dump_backtrace_and_stack(const ptrace_context_t* context, log_t* log, pid_t tid,
355 dump_backtrace(context, log, tid, at_fault, backtrace, frames);
356 dump_stack(context, log, tid, at_fault, backtrace, frames);
360 static void dump_map(log_t* log, map_info_t* m, const char* what, int scopeFlags) {
362 _LOG(log, scopeFlags, " %08x-%08x %c%c%c %s\n", m->start, m->end,
368 _LOG(log, scopeFlags, " (no %s)\n", what);
372 static void dump_nearby_maps(const ptrace_context_t* context, log_t* log, pid_t tid, bool at_fault) {
377 _LOG(log, scopeFlags, "cannot get siginfo for %d: %s\n",
391 _LOG(log, scopeFlags, "\nmemory map around fault addr %08x:\n", (int)si.si_addr);
419 dump_map(log, next, "map below", scopeFlags);
420 dump_map(log, map, "map for address", scopeFlags);
421 dump_map(log, prev, "map above", scopeFlags);
424 static void dump_thread(const ptrace_context_t* context, log_t* log, pid_t tid, bool at_fault,
428 dump_registers(context, log, tid, at_fault);
429 dump_backtrace_and_stack(context, log, tid, at_fault);
431 dump_memory_and_code(context, log, tid, at_fault);
432 dump_nearby_maps(context, log, tid, at_fault);
438 log_t* log, pid_t pid, pid_t tid, int* total_sleep_time_usec) {
469 _LOG(log, 0, "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n");
470 dump_thread_info(log, pid, new_tid, false);
471 dump_thread(context, log, new_tid, false, total_sleep_time_usec);
474 LOG("ptrace detach from %d failed: %s\n", new_tid, strerror(errno));
484 * Reads the contents of the specified log device, filters out the entries
489 static void dump_log_file(log_t* log, pid_t pid, const char* filename,
522 _LOG(log, 0, "Error while reading log: %s\n",
527 _LOG(log, 0, "Got zero bytes while reading log: %s\n",
547 _LOG(log, 0, "--------- %slog %s\n",
589 _LOG(log, 0, "%s.%03d %5d %5d %c %-8s: %s\n",
609 _LOG(log, 0, "%s\n", shortLog[shortLogNext]);
619 * "system" and "main" log devices. Ideally we'd interleave the output.
621 static void dump_logs(log_t* log, pid_t pid, bool tailOnly)
623 dump_log_file(log, pid, "/dev/log/system", tailOnly);
624 dump_log_file(log, pid, "/dev/log/main", tailOnly);
627 static void dump_abort_message(log_t* log, pid_t tid, uintptr_t address) {
659 _LOG(log, SCOPE_AT_FAULT, "Abort message: '%s'\n", msg);
665 static bool dump_crash(log_t* log, pid_t pid, pid_t tid, int signal, uintptr_t abort_msg_address,
668 /* don't copy log messages to tombstone unless this is a dev device */
673 if (log->amfd >= 0) {
680 TEMP_FAILURE_RETRY( write(log->amfd, &datum, 4) );
682 TEMP_FAILURE_RETRY( write(log->amfd, &datum, 4) );
685 _LOG(log, SCOPE_AT_FAULT,
687 dump_build_info(log);
688 dump_revision_info(log);
689 dump_thread_info(log, pid, tid, true);
691 dump_fault_addr(log, tid, signal);
693 dump_abort_message(log, tid, abort_msg_address);
696 dump_thread(context, log, tid, true, total_sleep_time_usec);
699 dump_logs(log, pid, true);
704 detach_failed = dump_sibling_thread_report(context, log, pid, tid, total_sleep_time_usec);
710 dump_logs(log, pid, false);
715 if (log->amfd >= 0) {
717 TEMP_FAILURE_RETRY( write(log->amfd, &eodMarker, 1) );
719 TEMP_FAILURE_RETRY( read(log->amfd, &eodMarker, 1) );
774 LOG("failed to open tombstone file '%s': %s\n", path, strerror(errno));
828 log_t log;
829 log.tfd = fd;
830 log.amfd = activity_manager_connect();
831 log.quiet = quiet;
832 *detach_failed = dump_crash(&log, pid, tid, signal, abort_msg_address, dump_sibling_threads,
835 close(log.amfd);