8134030: test/serviceability/dcmd/gc/HeapDumpTest fails to verify the dump
authoraeriksso
Thu, 05 Nov 2015 11:42:42 +0100
changeset 33778 790c99403d3c
parent 33770 888a51053190
child 33779 1ae4ab567b43
8134030: test/serviceability/dcmd/gc/HeapDumpTest fails to verify the dump Reviewed-by: dholmes
hotspot/src/share/vm/services/heapDumper.cpp
hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java
--- a/hotspot/src/share/vm/services/heapDumper.cpp	Thu Nov 05 07:22:48 2015 +0000
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Thu Nov 05 11:42:42 2015 +0100
@@ -897,8 +897,10 @@
 void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
   InstanceKlass* ik = InstanceKlass::cast(k);
 
-  // Ignore the class if it hasn't been initialized yet
-  if (!ik->is_linked()) {
+  // We can safepoint and do a heap dump at a point where we have a Klass,
+  // but no java mirror class has been setup for it. So we need to check
+  // that the class is at least loaded, to avoid crash from a null mirror.
+  if (!ik->is_loaded()) {
     return;
   }
 
--- a/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java	Thu Nov 05 07:22:48 2015 +0000
+++ b/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java	Thu Nov 05 11:42:42 2015 +0100
@@ -66,6 +66,7 @@
         String cmd = "GC.heap_dump " + heapDumpArgs + " " + dump.getAbsolutePath();
         executor.execute(cmd);
 
+        verifyHeapDump(dump);
         dump.delete();
     }