Don't hold any lock when visiting classes from JDWP
Computes reference type ids of all loaded classes without holding the class
linker lock. Because computing the JDWP reference type id can cause thread
suspension, we can't hold any lock. This is detected in debug build (using
libartd.so) and causes an abort.
Also adds missing thread safety annotations related to ObjectRegistry::lock_.
Bug: 17305632
Bug: 16720689
(cherry picked from commit 95795e286145a4aece5c4a095fa2e7e88ee2115a)
Change-Id: If4fb069790a0a3358ad49da8f75c62a54c0f0b56
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 488e6e7..c994f0b 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -1158,7 +1158,8 @@
};
ClassListCreator clc(classes);
- Runtime::Current()->GetClassLinker()->VisitClasses(ClassListCreator::Visit, &clc);
+ Runtime::Current()->GetClassLinker()->VisitClassesWithoutClassesLock(ClassListCreator::Visit,
+ &clc);
}
JDWP::JdwpError Dbg::GetClassInfo(JDWP::RefTypeId class_id, JDWP::JdwpTypeTag* pTypeTag,