OSDN Git Service

Remove SetStateUnsafe in Debugger::Disconnected.
authorHiroshi Yamauchi <yamauchi@google.com>
Tue, 24 May 2016 21:55:40 +0000 (14:55 -0700)
committerHiroshi Yamauchi <yamauchi@google.com>
Thu, 26 May 2016 18:45:13 +0000 (11:45 -0700)
The debugger thread has the exclusive mutator lock and doen't need to
switch to runnable while updating instrumentation.

This avoids a spurious failure of the DCHECK in the jdwp test.

Bug: 25262836

Change-Id: Ibfd0bc3936a877fd264396fcc4cc1af8d19a1645

runtime/debugger.cc
runtime/thread.h

index 55f68d3..c0811f1 100644 (file)
@@ -644,8 +644,7 @@ void Dbg::Disconnected() {
 
   LOG(INFO) << "Debugger is no longer active";
 
-  // Suspend all threads and exclusively acquire the mutator lock. Set the state of the thread
-  // to kRunnable to avoid scoped object access transitions. Remove the debugger as a listener
+  // Suspend all threads and exclusively acquire the mutator lock. Remove the debugger as a listener
   // and clear the object registry.
   Runtime* runtime = Runtime::Current();
   Thread* self = Thread::Current();
@@ -655,7 +654,6 @@ void Dbg::Disconnected() {
                                     gc::kGcCauseInstrumentation,
                                     gc::kCollectorTypeInstrumentation);
     ScopedSuspendAll ssa(__FUNCTION__);
-    ThreadState old_state = self->SetStateUnsafe(kRunnable);
     // Debugger may not be active at this point.
     if (IsDebuggerActive()) {
       {
@@ -676,7 +674,6 @@ void Dbg::Disconnected() {
       }
       gDebuggerActive = false;
     }
-    CHECK_EQ(self->SetStateUnsafe(old_state), kRunnable);
   }
 
   {
index 582a0cd..0591a75 100644 (file)
@@ -1119,7 +1119,7 @@ class Thread {
       SHARED_REQUIRES(Locks::mutator_lock_);
 
   // Avoid use, callers should use SetState. Used only by SignalCatcher::HandleSigQuit, ~Thread and
-  // Dbg::Disconnected.
+  // Dbg::ManageDeoptimization.
   ThreadState SetStateUnsafe(ThreadState new_state) {
     ThreadState old_state = GetState();
     if (old_state == kRunnable && new_state != kRunnable) {