Show ArtMethods in imgdiag
Since ArtMethods were moved out of mirror:: classes imgdiag does not
show information about them. Diff ArtMethods to facilitate finding
dirty memory there.
Bug: 38173645
Test: imgdiag --boot-image=/system/framework/boot.art --image-diff-pid=`pid system_server`
Change-Id: Icd86a9ef14d5177a297026c22c81c080f5c85fc1
diff --git a/runtime/image.cc b/runtime/image.cc
index c8581c1..0236f47 100644
--- a/runtime/image.cc
+++ b/runtime/image.cc
@@ -144,6 +144,19 @@
return os << "size=" << section.Size() << " range=" << section.Offset() << "-" << section.End();
}
+void ImageHeader::VisitObjects(ObjectVisitor* visitor,
+ uint8_t* base,
+ PointerSize pointer_size) const {
+ DCHECK_EQ(pointer_size, GetPointerSize());
+ const ImageSection& objects = GetObjectsSection();
+ static const size_t kStartPos = RoundUp(sizeof(ImageHeader), kObjectAlignment);
+ for (size_t pos = kStartPos; pos < objects.Size(); ) {
+ mirror::Object* object = reinterpret_cast<mirror::Object*>(base + objects.Offset() + pos);
+ visitor->Visit(object);
+ pos += RoundUp(object->SizeOf(), kObjectAlignment);
+ }
+}
+
void ImageHeader::VisitPackedArtFields(ArtFieldVisitor* visitor, uint8_t* base) const {
const ImageSection& fields = GetFieldsSection();
for (size_t pos = 0; pos < fields.Size(); ) {