summaryrefslogtreecommitdiff
path: root/tools/ahat/test/TestDump.java
diff options
context:
space:
mode:
author Richard Uhler <ruhler@google.com> 2016-05-13 14:19:37 -0700
committer Richard Uhler <ruhler@google.com> 2016-10-21 16:24:07 +0100
commitec78c78508fa5ef6bac78ee2face0d30e67cf913 (patch)
treef9959d9b691d35af9d4940703750523b7b5bd26e /tools/ahat/test/TestDump.java
parenta8188191477b7b5b01a3c4426c51c48cd55f6678 (diff)
Add support for proguard deobfuscation.
Test: m ahat-test, with obfuscation of test-dump.hprof added. Bug: 25812772 Change-Id: I0f257432da570aa146e6bb5c549f014aecc0c326
Diffstat (limited to 'tools/ahat/test/TestDump.java')
-rw-r--r--tools/ahat/test/TestDump.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/ahat/test/TestDump.java b/tools/ahat/test/TestDump.java
index c3a76e4f18..ebce61c2e8 100644
--- a/tools/ahat/test/TestDump.java
+++ b/tools/ahat/test/TestDump.java
@@ -19,8 +19,10 @@ package com.android.ahat;
import com.android.tools.perflib.heap.ClassObj;
import com.android.tools.perflib.heap.Field;
import com.android.tools.perflib.heap.Instance;
+import com.android.tools.perflib.heap.ProguardMap;
import java.io.File;
import java.io.IOException;
+import java.text.ParseException;
import java.util.Map;
/**
@@ -44,11 +46,21 @@ public class TestDump {
* For example:
* java -Dahat.test.dump.hprof=test-dump.hprof -jar ahat-tests.jar
*
- * An IOException is thrown if there is a failure reading the hprof file.
+ * An IOException is thrown if there is a failure reading the hprof file or
+ * the proguard map.
*/
private TestDump() throws IOException {
String hprof = System.getProperty("ahat.test.dump.hprof");
- mSnapshot = AhatSnapshot.fromHprof(new File(hprof));
+
+ String mapfile = System.getProperty("ahat.test.dump.map");
+ ProguardMap map = new ProguardMap();
+ try {
+ map.readFromFile(new File(mapfile));
+ } catch (ParseException e) {
+ throw new IOException("Unable to load proguard map", e);
+ }
+
+ mSnapshot = AhatSnapshot.fromHprof(new File(hprof), map);
}
/**