Use handles for GetReferringObjects
Required since VisitObjects may cause thread suspension. Fixes
failing jdwp tests.
Test: test-art-host
Test: art/tools/run-jdwp-tests.sh '--mode=host' '--variant=X32' --debug
Bug: 31113334
Change-Id: Ic11780b3778c83e7812bc90c0723a293537f376c
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 502ce4b..073750e 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -936,10 +936,11 @@
if (o == nullptr) {
return JDWP::ERR_INVALID_OBJECT;
}
- std::vector<ObjPtr<mirror::Object>> raw_instances;
- heap->GetReferringObjects(o, max_count, raw_instances);
+ VariableSizedHandleScope hs(Thread::Current());
+ std::vector<Handle<mirror::Object>> raw_instances;
+ heap->GetReferringObjects(hs, hs.NewHandle(o), max_count, raw_instances);
for (size_t i = 0; i < raw_instances.size(); ++i) {
- referring_objects->push_back(gRegistry->Add(raw_instances[i]));
+ referring_objects->push_back(gRegistry->Add(raw_instances[i].Get()));
}
return JDWP::ERR_NONE;
}