changeset 2439:e5605f29b00e

8159127: hprof heap dumps broken for lambda classdata Summary: Added class dump records for lambda related anonymous classes in the heap dump Reviewed-by: dsamersoff, sspitsyn Contributed-by: jini.george@oracle.com
author dsamersoff
date Tue, 20 Dec 2016 13:33:57 +0300
parents cf6786ed1bf5
children 1b60e1e7bbec
files test/lib/jdk/test/lib/hprof/parser/HprofReader.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/lib/jdk/test/lib/hprof/parser/HprofReader.java	Mon Dec 19 16:26:36 2016 +0100
+++ b/test/lib/jdk/test/lib/hprof/parser/HprofReader.java	Tue Dec 20 13:33:57 2016 +0300
@@ -151,6 +151,10 @@
 
     private Snapshot snapshot;
 
+    public static boolean verifyMagicNumber(int numberRead) {
+        return (numberRead == MAGIC_NUMBER);
+    }
+
     public HprofReader(String fileName, PositionDataInputStream in,
                        int dumpNumber, boolean callStack, int debugLevel)
                        throws IOException {
@@ -737,6 +741,12 @@
         long id = readID();
         StackTrace stackTrace = getStackTraceFromSerial(in.readInt());
         long classID = readID();
+        JavaClass searchedClass = snapshot.findClass(
+                                  "0x" + Long.toHexString(classID));
+        if (searchedClass == null) {
+            throw new IOException(
+                "Class Record for 0x" + Long.toHexString(classID) + " not found");
+        }
         int bytesFollowing = in.readInt();
         int bytesRead = (2 * identifierSize) + 8 + bytesFollowing;
         JavaObject jobj = new JavaObject(classID, start);