Add an option to disable native stack dumping on SIGQUIT.
Some of our (stress) run-tests do ANR dumping, which end up
stressing libunwind, that has known problems. To avoid getting
flakes due to libunwind, disable native stack dumping on SIGQUIT
for our run-tests.
bug:27185632
bug:24664297
Change-Id: I69085e48db903d6240448d71666ae2dcd091922e
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 7a45594..2ee1605 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -936,9 +936,9 @@
<< "]";
}
-void Thread::Dump(std::ostream& os, BacktraceMap* backtrace_map) const {
+void Thread::Dump(std::ostream& os, bool dump_native_stack, BacktraceMap* backtrace_map) const {
DumpState(os);
- DumpStack(os, backtrace_map);
+ DumpStack(os, dump_native_stack, backtrace_map);
}
mirror::String* Thread::GetThreadName(const ScopedObjectAccessAlreadyRunnable& soa) const {
@@ -1497,7 +1497,9 @@
}
}
-void Thread::DumpStack(std::ostream& os, BacktraceMap* backtrace_map) const {
+void Thread::DumpStack(std::ostream& os,
+ bool dump_native_stack,
+ BacktraceMap* backtrace_map) const {
// TODO: we call this code when dying but may not have suspended the thread ourself. The
// IsSuspended check is therefore racy with the use for dumping (normally we inhibit
// the race with the thread_suspend_count_lock_).
@@ -1510,7 +1512,7 @@
}
if (safe_to_dump) {
// If we're currently in native code, dump that stack before dumping the managed stack.
- if (dump_for_abort || ShouldShowNativeStack(this)) {
+ if (dump_native_stack && (dump_for_abort || ShouldShowNativeStack(this))) {
DumpKernelStack(os, GetTid(), " kernel: ", false);
ArtMethod* method = GetCurrentMethod(nullptr, !dump_for_abort);
DumpNativeStack(os, GetTid(), backtrace_map, " native: ", method);