Add sanity checking to declaring class visiting
When we have an unmarked declaring class in the image, it will
SIGSEGV due to the bitmap being read-only. Print some useful
info to try and debug this.
This probably hurts performance a bit, TODO disable when the bug is
fixed.
Bug: 27493510
(cherry picked from commit b33b1dc78d178060ff0f4327d448fd3a89df51de)
Change-Id: I0c25afd5a6101a71fa1494e12dc019ba64bf43be
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 5ff1cb7..22bf5f9 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -1520,6 +1520,17 @@
/*out*/error_msg);
}
+void ImageSpace::DumpSections(std::ostream& os) const {
+ const uint8_t* base = Begin();
+ const ImageHeader& header = GetImageHeader();
+ for (size_t i = 0; i < ImageHeader::kSectionCount; ++i) {
+ auto section_type = static_cast<ImageHeader::ImageSections>(i);
+ const ImageSection& section = header.GetImageSection(section_type);
+ os << section_type << " " << reinterpret_cast<const void*>(base + section.Offset())
+ << "-" << reinterpret_cast<const void*>(base + section.End()) << "\n";
+ }
+}
+
} // namespace space
} // namespace gc
} // namespace art