ART: Remove suspension from AttachAgent
It conflicts with calls later. Every plugin needs to do local
protections for itself.
Follow-up to commit ad2dc875ce29c3fafc1129a2a25184df28b66a10.
Bug: 31682382
Bug: 34275017
Test: m test-art-host-run-test-909-attach-agent
Change-Id: Ib698d880feb774a00c819ef14c27a48501ca1f13
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index df5fc5c..55e1852 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1384,11 +1384,6 @@
Plugin new_plugin = Plugin::Create(plugin_name);
- // Suspend all threads to protect ourself somewhat.
- Thread* self = Thread::Current();
- ScopedObjectAccess soa(self); // Now we know we have the shared lock.
- ScopedThreadSuspension sts(self, art::kWaitingForDebuggerToAttach);
- ScopedSuspendAll ssa("EnsureJvmtiPlugin");
if (!new_plugin.Load(error_msg)) {
return false;
}
@@ -2235,6 +2230,8 @@
gc::ScopedGCCriticalSection gcs(Thread::Current(),
gc::kGcCauseAddRemoveSystemWeakHolder,
gc::kCollectorTypeAddRemoveSystemWeakHolder);
+ // Note: The ScopedGCCriticalSection also ensures that the rest of the function is in
+ // a critical section.
system_weak_holders_.push_back(holder);
}