summaryrefslogtreecommitdiff
path: root/runtime/debugger.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r--runtime/debugger.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 7006f70687..ada1a237d6 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -892,15 +892,16 @@ JDWP::JdwpError Dbg::GetInstanceCounts(const std::vector<JDWP::RefTypeId>& class
std::vector<uint64_t>* counts) {
gc::Heap* heap = Runtime::Current()->GetHeap();
heap->CollectGarbage(false);
- std::vector<mirror::Class*> classes;
+ VariableSizedHandleScope hs(Thread::Current());
+ std::vector<Handle<mirror::Class>> classes;
counts->clear();
for (size_t i = 0; i < class_ids.size(); ++i) {
JDWP::JdwpError error;
- mirror::Class* c = DecodeClass(class_ids[i], &error);
+ ObjPtr<mirror::Class> c = DecodeClass(class_ids[i], &error);
if (c == nullptr) {
return error;
}
- classes.push_back(c);
+ classes.push_back(hs.NewHandle(c));
counts->push_back(0);
}
heap->CountInstances(classes, false, &(*counts)[0]);
@@ -913,14 +914,15 @@ JDWP::JdwpError Dbg::GetInstances(JDWP::RefTypeId class_id, int32_t max_count,
// We only want reachable instances, so do a GC.
heap->CollectGarbage(false);
JDWP::JdwpError error;
- mirror::Class* c = DecodeClass(class_id, &error);
+ ObjPtr<mirror::Class> c = DecodeClass(class_id, &error);
if (c == nullptr) {
return error;
}
- std::vector<mirror::Object*> raw_instances;
- Runtime::Current()->GetHeap()->GetInstances(c, max_count, raw_instances);
+ VariableSizedHandleScope hs(Thread::Current());
+ std::vector<Handle<mirror::Object>> raw_instances;
+ Runtime::Current()->GetHeap()->GetInstances(hs, hs.NewHandle(c), max_count, raw_instances);
for (size_t i = 0; i < raw_instances.size(); ++i) {
- instances->push_back(gRegistry->Add(raw_instances[i]));
+ instances->push_back(gRegistry->Add(raw_instances[i].Get()));
}
return JDWP::ERR_NONE;
}
@@ -930,14 +932,15 @@ JDWP::JdwpError Dbg::GetReferringObjects(JDWP::ObjectId object_id, int32_t max_c
gc::Heap* heap = Runtime::Current()->GetHeap();
heap->CollectGarbage(false);
JDWP::JdwpError error;
- mirror::Object* o = gRegistry->Get<mirror::Object*>(object_id, &error);
+ ObjPtr<mirror::Object> o = gRegistry->Get<mirror::Object*>(object_id, &error);
if (o == nullptr) {
return JDWP::ERR_INVALID_OBJECT;
}
- std::vector<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;
}