Improve printing for heap verification failures
Avoid printing proc maps since they are already printed in the
tombstone. Printing them again may cause truncated output.
Change ordering to put important data first since the latter lines
are more likely to get truncated.
Test: test-art-host-gtest
Bug: 139805154
Change-Id: I27a2da4831643fd2eb42f39900f3e3ed98acd04d
diff --git a/runtime/gc/verification.cc b/runtime/gc/verification.cc
index 8670a22..9e0b8a2 100644
--- a/runtime/gc/verification.cc
+++ b/runtime/gc/verification.cc
@@ -86,10 +86,7 @@
MemberOffset offset,
mirror::Object* ref,
bool fatal) const {
- // Lowest priority logging first:
- PrintFileToLog("/proc/self/maps", android::base::LogSeverity::FATAL_WITHOUT_ABORT);
- MemMap::DumpMaps(LOG_STREAM(FATAL_WITHOUT_ABORT), /* terse= */ true);
- Runtime::Current()->GetHeap()->DumpSpaces(LOG_STREAM(FATAL_WITHOUT_ABORT));
+ // Highest priority logging first.
// Buffer the output in the string stream since it is more important than the stack traces
// and we want it to have log priority. The stack traces are printed from Runtime::Abort
// which is called from LOG(FATAL) but before the abort message.
@@ -110,6 +107,8 @@
oss << " reference addr"
<< DumpRAMAroundAddress(reinterpret_cast<uintptr_t>(addr), 4 * kObjectAlignment);
}
+ Runtime::Current()->GetHeap()->DumpSpaces(oss);
+ MemMap::DumpMaps(oss, /* terse= */ true);
if (fatal) {
LOG(FATAL) << oss.str();