summaryrefslogtreecommitdiff
path: root/runtime/reference_table.cc
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2016-09-27 18:45:02 -0700
committer Andreas Gampe <agampe@google.com> 2016-09-28 09:56:41 -0700
commita3bbf8bf436fd7567097b8ca0d7bd24fdf5ae08b (patch)
treee01c088615fe1b8354099033e25cf68e5801234d /runtime/reference_table.cc
parent1b6cf7fbca0fd90ae58938e4a16a77b79a83408e (diff)
ART: Dump referenced type in IRT overflows
When the runtime dumps a reference table, e.g., when aborting for an overflow, dump the type of stored referents for reference types to aid in debugging leaks. Bug: 31600693 Test: m test-art-host-gtest-reference_table_test Change-Id: Ia892dc84ca8827dd93a8b75d6f571c392f94859c (cherry picked from commit 280f32b095f55f24dc557f9a9067d223901214ce)
Diffstat (limited to 'runtime/reference_table.cc')
-rw-r--r--runtime/reference_table.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/reference_table.cc b/runtime/reference_table.cc
index f04d41dc80..0be79efb76 100644
--- a/runtime/reference_table.cc
+++ b/runtime/reference_table.cc
@@ -192,6 +192,13 @@ void ReferenceTable::Dump(std::ostream& os, Table& entries) {
} else {
StringAppendF(&extras, " \"%.16s... (%d chars)", utf8.c_str(), s->GetLength());
}
+ } else if (ref->IsReferenceInstance()) {
+ mirror::Object* referent = ref->AsReference()->GetReferent();
+ if (referent == nullptr) {
+ extras = " (referent is null)";
+ } else {
+ extras = StringPrintf(" (referent is a %s)", PrettyTypeOf(referent).c_str());
+ }
}
os << StringPrintf(" %5d: ", idx) << ref << " " << className << extras << "\n";
}