ahat: show sample path through strong references.
Instead of showing a sample path through weak references, which is
much less useful for debugging why the object is retained.
Change-Id: I2b8d8bc9368cdcabd7a369e45278ba9b44a38e40
Bug: 64592321
Test: m ahat-test, with new gcRootPathNotWeak test added.
diff --git a/tools/ahat/test/InstanceTest.java b/tools/ahat/test/InstanceTest.java
index f0e7f44..e05782c 100644
--- a/tools/ahat/test/InstanceTest.java
+++ b/tools/ahat/test/InstanceTest.java
@@ -285,6 +285,18 @@
}
@Test
+ public void gcRootPathNotWeak() throws IOException {
+ TestDump dump = TestDump.getTestDump();
+
+ AhatInstance strong = dump.getDumpedAhatInstance("aLongStrongPathToSamplePathObject");
+ AhatInstance strong2 = strong.getField("referent").asAhatInstance();
+ AhatInstance object = strong2.getField("referent").asAhatInstance();
+
+ List<PathElement> path = object.getPathFromGcRoot();
+ assertEquals(strong2, path.get(path.size() - 2).instance);
+ }
+
+ @Test
public void retainedSize() throws IOException {
TestDump dump = TestDump.getTestDump();