8134030: test/serviceability/dcmd/gc/HeapDumpTest fails to verify the dump

Thu, 05 Nov 2015 11:42:42 +0100

author
aeriksso
date
Thu, 05 Nov 2015 11:42:42 +0100
changeset 9668
acb9351e3a29
parent 9667
1a1aec8c87b7
child 9669
32bc598624bd

8134030: test/serviceability/dcmd/gc/HeapDumpTest fails to verify the dump
Reviewed-by: dholmes

src/share/vm/services/heapDumper.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/services/heapDumper.cpp	Fri Jan 18 17:05:41 2019 +0100
     1.2 +++ b/src/share/vm/services/heapDumper.cpp	Thu Nov 05 11:42:42 2015 +0100
     1.3 @@ -941,8 +941,14 @@
     1.4  // its array classes
     1.5  void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
     1.6    Klass* klass = k;
     1.7 -  assert(klass->oop_is_instance(), "not an InstanceKlass");
     1.8 -  InstanceKlass* ik = (InstanceKlass*)klass;
     1.9 +  InstanceKlass* ik = InstanceKlass::cast(k);
    1.10 +
    1.11 +  // We can safepoint and do a heap dump at a point where we have a Klass,
    1.12 +  // but no java mirror class has been setup for it. So we need to check
    1.13 +  // that the class is at least loaded, to avoid crash from a null mirror.
    1.14 +  if (!ik->is_loaded()) {
    1.15 +    return;
    1.16 +  }
    1.17  
    1.18    writer->write_u1(HPROF_GC_CLASS_DUMP);
    1.19  

mercurial