diff options
author | Brigid Smith <brigidsmith@google.com> | 2014-06-10 11:53:08 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-06-16 14:41:21 -0700 |
commit | 62ba489ba00a2689d4e257bc178cff87495f99d7 (patch) | |
tree | 822e4e940901af653cb6ecdd4a5d756e9c81ee43 /debuggerd/backtrace.cpp | |
parent | 59d16c9e9171f4367ad3a0516e7000c0d95e89cf (diff) | |
download | system_core-62ba489ba00a2689d4e257bc178cff87495f99d7.tar.gz system_core-62ba489ba00a2689d4e257bc178cff87495f99d7.tar.bz2 system_core-62ba489ba00a2689d4e257bc178cff87495f99d7.zip |
Changing how debuggerd filters log messages to different locations.
The system by which debuggerd filters its output to different locations
is now based on an enum called logtype with easy to understand
categories for log messages (like THREAD, MEMORY, etc.) instead of the
old, fairly esoteric scope_flags variable. Now much of the output that
previously went to logcat does not show up on the screen, but all output
can be found in the tombstone file. In addition, the tombstone's
location is now printed so it can be located easily.
Bug: 15341747
Change-Id: Ia2f2051d1dfdea934d0e6ed220f24345e35ba6a2
Diffstat (limited to 'debuggerd/backtrace.cpp')
-rw-r--r-- | debuggerd/backtrace.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/debuggerd/backtrace.cpp b/debuggerd/backtrace.cpp index d3883485c..d08242e76 100644 --- a/debuggerd/backtrace.cpp +++ b/debuggerd/backtrace.cpp @@ -30,6 +30,7 @@ #include <UniquePtr.h> #include "backtrace.h" + #include "utility.h" static void dump_process_header(log_t* log, pid_t pid) { @@ -49,15 +50,15 @@ static void dump_process_header(log_t* log, pid_t pid) { localtime_r(&t, &tm); char timestr[64]; strftime(timestr, sizeof(timestr), "%F %T", &tm); - _LOG(log, SCOPE_AT_FAULT, "\n\n----- pid %d at %s -----\n", pid, timestr); + _LOG(log, logtype::BACKTRACE, "\n\n----- pid %d at %s -----\n", pid, timestr); if (procname) { - _LOG(log, SCOPE_AT_FAULT, "Cmd line: %s\n", procname); + _LOG(log, logtype::BACKTRACE, "Cmd line: %s\n", procname); } } static void dump_process_footer(log_t* log, pid_t pid) { - _LOG(log, SCOPE_AT_FAULT, "\n----- end %d -----\n", pid); + _LOG(log, logtype::BACKTRACE, "\n----- end %d -----\n", pid); } static void dump_thread( @@ -79,10 +80,10 @@ static void dump_thread( } } - _LOG(log, SCOPE_AT_FAULT, "\n\"%s\" sysTid=%d\n", threadname ? threadname : "<unknown>", tid); + _LOG(log, logtype::BACKTRACE, "\n\"%s\" sysTid=%d\n", threadname ? threadname : "<unknown>", tid); if (!attached && ptrace(PTRACE_ATTACH, tid, 0, 0) < 0) { - _LOG(log, SCOPE_AT_FAULT, "Could not attach to thread: %s\n", strerror(errno)); + _LOG(log, logtype::BACKTRACE, "Could not attach to thread: %s\n", strerror(errno)); return; } @@ -90,11 +91,11 @@ static void dump_thread( UniquePtr<Backtrace> backtrace(Backtrace::Create(tid, BACKTRACE_CURRENT_THREAD)); if (backtrace->Unwind(0)) { - dump_backtrace_to_log(backtrace.get(), log, SCOPE_AT_FAULT, " "); + dump_backtrace_to_log(backtrace.get(), log, " "); } if (!attached && ptrace(PTRACE_DETACH, tid, 0, 0) != 0) { - LOG("ptrace detach from %d failed: %s\n", tid, strerror(errno)); + LOG_ERROR("ptrace detach from %d failed: %s\n", tid, strerror(errno)); *detach_failed = true; } } @@ -133,9 +134,8 @@ void dump_backtrace(int fd, int amfd, pid_t pid, pid_t tid, bool* detach_failed, dump_process_footer(&log, pid); } -void dump_backtrace_to_log(Backtrace* backtrace, log_t* log, - int scope_flags, const char* prefix) { +void dump_backtrace_to_log(Backtrace* backtrace, log_t* log, const char* prefix) { for (size_t i = 0; i < backtrace->NumFrames(); i++) { - _LOG(log, scope_flags, "%s%s\n", prefix, backtrace->FormatFrameData(i).c_str()); + _LOG(log, logtype::BACKTRACE, "%s%s\n", prefix, backtrace->FormatFrameData(i).c_str()); } } |