Ignore not yet loaded classes during hprof
Skips classes that are no yet loaded because we cannot access its
fields nor its superclass. This CL fixes a crash observed during the
run-test 130-hprof.
Bug: 20040824
Change-Id: Ia618b6c1579d35dfd726726ca6d2ff4258d8a841
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index d6a6595..cdb3e2a 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -949,6 +949,10 @@
}
void Hprof::DumpHeapClass(mirror::Class* klass) {
+ if (!klass->IsLoaded() && !klass->IsErroneous()) {
+ // Class is allocated but not yet loaded: we cannot access its fields or super class.
+ return;
+ }
size_t sFieldCount = klass->NumStaticFields();
if (sFieldCount != 0) {
int byteLength = sFieldCount * sizeof(JValue); // TODO bogus; fields are packed