Avoid resolution for field types in image dumping.

Bug seen when dumping EMPTY_TABLE of java.util.HashMap as EMPTY_TABLE has type
java.util.Map$Entry[] which isn't in the boot image, but the value has type
java.util.HashMap$HashMapEntry[] which is.

Change-Id: Ia0bd445c6f5bb5837a92e6c2b2f4207e89b872f4
diff --git a/src/oatdump.cc b/src/oatdump.cc
index 538e1bb..a8a0e86 100644
--- a/src/oatdump.cc
+++ b/src/oatdump.cc
@@ -853,7 +853,13 @@
       if (value == NULL) {
         os << StringPrintf("null   %s\n", PrettyDescriptor(descriptor).c_str());
       } else {
-        PrettyObjectValue(os, fh.GetType(), value);
+        // Grab the field type without causing resolution.
+        mirror::Class* field_type = fh.GetType(false);
+        if (field_type != NULL) {
+          PrettyObjectValue(os, field_type, value);
+        } else {
+          os << StringPrintf("%p   %s\n", value, PrettyDescriptor(descriptor).c_str());
+        }
       }
     }
   }
diff --git a/src/object_utils.h b/src/object_utils.h
index 6c6f60b..6a07425 100644
--- a/src/object_utils.h
+++ b/src/object_utils.h
@@ -282,13 +282,13 @@
       return field_index == 0 ? "interfaces" : "throws";
     }
   }
-  mirror::Class* GetType() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+  mirror::Class* GetType(bool resolve = true) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     uint32_t field_index = field_->GetDexFieldIndex();
     if (!field_->GetDeclaringClass()->IsProxyClass()) {
       const DexFile& dex_file = GetDexFile();
       const DexFile::FieldId& field_id = dex_file.GetFieldId(field_index);
       mirror::Class* type = GetDexCache()->GetResolvedType(field_id.type_idx_);
-      if (type == NULL) {
+      if (resolve && (type == NULL)) {
         type = GetClassLinker()->ResolveType(field_id.type_idx_, field_);
         CHECK(type != NULL || Thread::Current()->IsExceptionPending());
       }