Add support for proguard deobfuscation.
Test: m ahat-test, with obfuscation of test-dump.hprof added.
Bug: 25812772
Change-Id: I0f257432da570aa146e6bb5c549f014aecc0c326
diff --git a/tools/ahat/test/TestDump.java b/tools/ahat/test/TestDump.java
index c3a76e4..ebce61c 100644
--- a/tools/ahat/test/TestDump.java
+++ b/tools/ahat/test/TestDump.java
@@ -19,8 +19,10 @@
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 @@
* 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);
}
/**