ART: Use cerr for host unexpected errors
Use cerr and endl when dumping unexpected signals on Linux. This
simulates the previous special-casing of INTERNAL_FATAL to
immediately print output.
Bug: 31338270
Test: m test-art-host
Test: manual segfault
Change-Id: I9d4471836339bf69681cc4aa43df6d558e7f123d
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc
index c20c8b8..6b9468d 100644
--- a/runtime/native_stack_dump.cc
+++ b/runtime/native_stack_dump.cc
@@ -296,10 +296,10 @@
std::unique_ptr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS, tid, map));
if (!backtrace->Unwind(0, reinterpret_cast<ucontext*>(ucontext_ptr))) {
os << prefix << "(backtrace::Unwind failed for thread " << tid
- << ": " << backtrace->GetErrorString(backtrace->GetError()) << ")\n";
+ << ": " << backtrace->GetErrorString(backtrace->GetError()) << ")" << std::endl;
return;
} else if (backtrace->NumFrames() == 0) {
- os << prefix << "(no native stack frames for thread " << tid << ")\n";
+ os << prefix << "(no native stack frames for thread " << tid << ")" << std::endl;
return;
}
@@ -354,7 +354,7 @@
}
os << ")";
}
- os << "\n";
+ os << std::endl;
if (try_addr2line && use_addr2line) {
Addr2line(it->map.name, it->pc - it->map.start, os, prefix, &addr2line_state);
}
@@ -395,7 +395,7 @@
if (include_count) {
os << StringPrintf("#%02zd ", i);
}
- os << text << "\n";
+ os << text << std::endl;
}
}