diff options
| author | 2018-11-06 15:34:38 -0800 | |
|---|---|---|
| committer | 2018-11-07 08:22:19 -0800 | |
| commit | 48f8a24420237a550dd789159f84ff064042cbf5 (patch) | |
| tree | 3786c739901430fba62d91370da1f3be1397b44e | |
| parent | 5f04f7f666373b470c3a0e01cd6575d850b47adf (diff) | |
ART: Clean up timeout_dumper
Address previous comments. Use cerr for stack trace to avoid visual
clutter.
Test: m test-art-host
Test: manual
Change-Id: I1ce1c9b6ef4787ad9489055af01ab115fc462efd
| -rw-r--r-- | tools/timeout_dumper/timeout_dumper.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/timeout_dumper/timeout_dumper.cc b/tools/timeout_dumper/timeout_dumper.cc index eeaf7de991..30e194ceda 100644 --- a/tools/timeout_dumper/timeout_dumper.cc +++ b/tools/timeout_dumper/timeout_dumper.cc @@ -25,6 +25,7 @@ #include <csignal> #include <cstdlib> #include <cstring> +#include <iostream> #include <thread> #include <memory> #include <set> @@ -246,10 +247,7 @@ void Drain(size_t expected, break; } else { - char saved = *(new_line + 1); - *(new_line + 1) = 0; - os << tmp; - *(new_line + 1) = saved; + os << std::string(tmp, new_line - tmp + 1); tmp = new_line + 1; prefix_written = false; @@ -284,7 +282,7 @@ void Addr2line(const std::string& addr2line, } pipe->reset(); // Close early. - const char* args[7] = { + const char* args[] = { addr2line.c_str(), "--functions", "--inlines", @@ -421,6 +419,9 @@ void DumpThread(pid_t pid, const std::string* addr2line_path, const char* prefix, BacktraceMap* map) { + // Use std::cerr to avoid the LOG prefix. + std::cerr << std::endl << "=== pid: " << pid << " tid: " << tid << " ===" << std::endl; + constexpr uint32_t kMaxWaitMicros = 1000 * 1000; // 1s. if (pid != tid && !WaitForSigStopped(tid, kMaxWaitMicros)) { LOG(ERROR) << "Failed to wait for sigstop on " << tid; @@ -477,19 +478,19 @@ void DumpThread(pid_t pid, } oss << ")"; } - LOG(ERROR) << oss.str(); + std::cerr << oss.str() << std::endl; if (try_addr2line && addr2line_path != nullptr) { addr2line::Addr2line(*addr2line_path, it->map.name, it->rel_pc, - LOG_STREAM(ERROR), + std::cerr, prefix, &addr2line_state); } } if (addr2line_state != nullptr) { - addr2line::Drain(0, prefix, &addr2line_state, LOG_STREAM(ERROR)); + addr2line::Drain(0, prefix, &addr2line_state, std::cerr); } } @@ -519,7 +520,6 @@ void DumpProcess(pid_t forked_pid, const std::atomic<bool>& saw_wif_stopped_for_ } for (pid_t tid : tids) { - LOG(ERROR) << "pid: " << forked_pid << " tid: " << tid; DumpThread(forked_pid, tid, use_addr2line ? addr2line_path.get() : nullptr, |