Don't use ScopedObjectAccess in Heap::DumpSpaces
ScopedObjectAccess does not work well if the mutator lock is
excusively held while in a suspend thread state. This caused
deadlocks and DCHECK failures.
Bug: 27493316
(cherry picked from commit 03d21bc5bed887243ff6ce3531179185ffd3532c)
Change-Id: I5d67f74fc7082761e45dc1d7778b0ea7fceaaf8f
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 889069d..e0a53a0 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -651,8 +651,8 @@
}
}
- std::string DumpSpaces() const WARN_UNUSED;
- void DumpSpaces(std::ostream& stream) const;
+ void DumpSpaces(std::ostream& stream) const SHARED_REQUIRES(Locks::mutator_lock_);
+ std::string DumpSpaces() const SHARED_REQUIRES(Locks::mutator_lock_);
// Dump object should only be used by the signal handler.
void DumpObject(std::ostream& stream, mirror::Object* obj) NO_THREAD_SAFETY_ANALYSIS;