Add missing debugger root visiting.
Bug: 13634574
Change-Id: I2a76f6c43f1d0ad1922f06deb40a71ff651129fd
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 43e8bb9..c18d5c6 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -104,6 +104,12 @@
mirror::ArtMethod* method;
uint32_t dex_pc;
Breakpoint(mirror::ArtMethod* method, uint32_t dex_pc) : method(method), dex_pc(dex_pc) {}
+
+ void VisitRoots(RootCallback* callback, void* arg) {
+ if (method != nullptr) {
+ callback(reinterpret_cast<mirror::Object**>(&method), arg, 0, kRootDebugger);
+ }
+ }
};
static std::ostream& operator<<(std::ostream& os, const Breakpoint& rhs)
@@ -209,6 +215,29 @@
// Breakpoints.
static std::vector<Breakpoint> gBreakpoints GUARDED_BY(Locks::breakpoint_lock_);
+void DebugInvokeReq::VisitRoots(RootCallback* callback, void* arg, uint32_t tid,
+ RootType root_type) {
+ if (receiver != nullptr) {
+ callback(&receiver, arg, tid, root_type);
+ }
+ if (thread != nullptr) {
+ callback(&thread, arg, tid, root_type);
+ }
+ if (klass != nullptr) {
+ callback(reinterpret_cast<mirror::Object**>(&klass), arg, tid, root_type);
+ }
+ if (method != nullptr) {
+ callback(reinterpret_cast<mirror::Object**>(&method), arg, tid, root_type);
+ }
+}
+
+void SingleStepControl::VisitRoots(RootCallback* callback, void* arg, uint32_t tid,
+ RootType root_type) {
+ if (method != nullptr) {
+ callback(reinterpret_cast<mirror::Object**>(&method), arg, tid, root_type);
+ }
+}
+
static bool IsBreakpoint(const mirror::ArtMethod* m, uint32_t dex_pc)
LOCKS_EXCLUDED(Locks::breakpoint_lock_)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -494,6 +523,13 @@
}
}
+void Dbg::VisitRoots(RootCallback* callback, void* arg) {
+ MutexLock mu(Thread::Current(), *Locks::breakpoint_lock_);
+ for (Breakpoint& bp : gBreakpoints) {
+ bp.VisitRoots(callback, arg);
+ }
+}
+
void Dbg::StopJdwp() {
// Prevent the JDWP thread from processing JDWP incoming packets after we close the connection.
Disposed();
@@ -3861,7 +3897,7 @@
}
}
-void Dbg::UpdateObjectPointers(IsMarkedCallback* visitor, void* arg) {
+void Dbg::UpdateObjectPointers(IsMarkedCallback* callback, void* arg) {
if (recent_allocation_records_ != nullptr) {
MutexLock mu(Thread::Current(), *alloc_tracker_lock_);
size_t i = HeadIndex();
@@ -3869,12 +3905,12 @@
while (count--) {
AllocRecord* record = &recent_allocation_records_[i];
DCHECK(record != nullptr);
- record->UpdateObjectPointers(visitor, arg);
+ record->UpdateObjectPointers(callback, arg);
i = (i + 1) & (alloc_record_max_ - 1);
}
}
if (gRegistry != nullptr) {
- gRegistry->UpdateObjectPointers(visitor, arg);
+ gRegistry->UpdateObjectPointers(callback, arg);
}
}