From 7c1f53e4253e6acff5e76f00e6bf666518068c4d Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 3 Jun 2015 10:51:13 -0700 Subject: [PATCH] Emit instance fields for java.lang.Object in hprof Previously we omitted these fields. (cherry picked from commit 0adc90eb0592e220f787f87dbef3a9b5c1db2080) Bug: 20726205 Change-Id: I81c55919a4bd015bc0a4e7259a41a05dab534e11 --- runtime/hprof/hprof.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc index 917fe4360..922fc5f53 100644 --- a/runtime/hprof/hprof.cc +++ b/runtime/hprof/hprof.cc @@ -1040,7 +1040,7 @@ void Hprof::DumpHeapClass(mirror::Class* klass) { } // Instance fields for this class (no superclass fields) - int iFieldCount = klass->IsObjectClass() ? 0 : klass->NumInstanceFields(); + int iFieldCount = klass->NumInstanceFields(); if (klass->IsStringClass()) { __ AddU2((uint16_t)iFieldCount + 1); } else { @@ -1114,7 +1114,7 @@ void Hprof::DumpHeapInstanceObject(mirror::Object* obj, mirror::Class* klass) { // Write the instance data; fields for this class, followed by super class fields, // and so on. Don't write the klass or monitor fields of Object.class. mirror::Class* orig_klass = klass; - while (!klass->IsObjectClass()) { + do { int ifieldCount = klass->NumInstanceFields(); for (int i = 0; i < ifieldCount; ++i) { ArtField* f = klass->GetInstanceField(i); @@ -1146,7 +1146,7 @@ void Hprof::DumpHeapInstanceObject(mirror::Object* obj, mirror::Class* klass) { } klass = klass->GetSuperClass(); - } + } while (klass != nullptr); // Output native value character array for strings. if (orig_klass->IsStringClass()) { -- 2.11.0