OSDN Git Service

ART: Allow unwinding unattached threads
authorAndreas Gampe <agampe@google.com>
Tue, 1 Mar 2016 22:38:37 +0000 (14:38 -0800)
committerAndreas Gampe <agampe@google.com>
Tue, 1 Mar 2016 22:38:37 +0000 (14:38 -0800)
Partial revert of commit ed8b723c5f3989d2593ec21c65c96d6d8bf25579.

Make it (constexpr) configurable whether we allow unwinding native
stacks of unattached threads.

Change-Id: Ibb1fd0956fb796583f78ec9c3a74521f6fbe96d9

runtime/thread_list.cc

index 49d54fd..d45e4bd 100644 (file)
@@ -59,6 +59,10 @@ static constexpr useconds_t kThreadSuspendInitialSleepUs = 0;
 static constexpr useconds_t kThreadSuspendMaxYieldUs = 3000;
 static constexpr useconds_t kThreadSuspendMaxSleepUs = 5000;
 
+// Whether we should try to dump the native stack of unattached threads. See commit ed8b723 for
+// some history.
+static constexpr bool kDumpUnattachedThreadNativeStack = true;
+
 ThreadList::ThreadList()
     : suspend_all_count_(0),
       debug_suspend_all_count_(0),
@@ -149,9 +153,7 @@ static void DumpUnattachedThread(std::ostream& os, pid_t tid) NO_THREAD_SAFETY_A
   // refactor DumpState to avoid skipping analysis.
   Thread::DumpState(os, nullptr, tid);
   DumpKernelStack(os, tid, "  kernel: ", false);
-  // TODO: Reenable this when the native code in system_server can handle it.
-  // Currently "adb shell kill -3 `pid system_server`" will cause it to exit.
-  if (false) {
+  if (kDumpUnattachedThreadNativeStack) {
     DumpNativeStack(os, tid, nullptr, "  native: ");
   }
   os << "\n";