OSDN Git Service

Improve debugging output for a crash.
authorVladimir Marko <vmarko@google.com>
Wed, 8 Mar 2017 14:40:47 +0000 (14:40 +0000)
committerVladimir Marko <vmarko@google.com>
Wed, 8 Mar 2017 14:40:47 +0000 (14:40 +0000)
Bug: 34839984
Test: m test-art-host-gtest
Test: testrunner.py --host
Change-Id: I7cf1e33c42cfae75d7a132d66a4d293173ed9b6c

runtime/class_linker.cc

index d232714..74c497b 100644 (file)
@@ -4926,7 +4926,15 @@ bool ClassLinker::InitializeDefaultInterfaceRecursive(Thread* self,
     // First we initialize all of iface's super-interfaces recursively.
     for (size_t i = 0; i < num_direct_ifaces; i++) {
       ObjPtr<mirror::Class> super_iface = mirror::Class::GetDirectInterface(self, iface.Get(), i);
-      DCHECK(super_iface != nullptr);
+      if (UNLIKELY(super_iface == nullptr)) {
+        const char* iface_descriptor =
+            iface->GetDexFile().StringByTypeIdx(iface->GetDirectInterfaceTypeIdx(i));
+        LOG(FATAL) << "Check failed: super_iface != nullptr "
+            << "Debug data for bug 34839984: "
+            << iface->PrettyDescriptor() << " iface #" << i << " " << iface_descriptor
+            << " space: " << DescribeSpace(iface.Get())
+            << " loaders: " << DescribeLoaders(iface.Get(), iface_descriptor);
+      }
       if (!super_iface->HasBeenRecursivelyInitialized()) {
         // Recursive step
         handle_super_iface.Assign(super_iface);