Fix and extend debugging output for bug 74410240.

Test: Manually break in the resolution trampoline and
      force printing the message.
Bug: 74410240

(cherry picked from commit 606adb3a515b31e6d4b02becb36f732918fe7713)

Change-Id: I9bd79f80012b99838c0765e9934f69b4763d70a5
Merged-In: I5f3fea53a7ec2170b644fb13bca84bae099243c8
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 2eb3ab9..66cec71 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -19,6 +19,7 @@
 #include "base/enums.h"
 #include "callee_save_frame.h"
 #include "common_throws.h"
+#include "debug_print.h"
 #include "debugger.h"
 #include "dex/dex_file-inl.h"
 #include "dex/dex_file_types.h"
@@ -1187,9 +1188,24 @@
   }
 }
 
+static void DumpB74410240ClassData(ObjPtr<mirror::Class> klass)
+    REQUIRES_SHARED(Locks::mutator_lock_) {
+  std::string storage;
+  const char* descriptor = klass->GetDescriptor(&storage);
+  LOG(FATAL_WITHOUT_ABORT) << "  " << DescribeLoaders(klass->GetClassLoader(), descriptor);
+  const OatDexFile* oat_dex_file = klass->GetDexFile().GetOatDexFile();
+  if (oat_dex_file != nullptr) {
+    const OatFile* oat_file = oat_dex_file->GetOatFile();
+    const char* dex2oat_cmdline =
+        oat_file->GetOatHeader().GetStoreValueByKey(OatHeader::kDex2OatCmdLineKey);
+    LOG(FATAL_WITHOUT_ABORT) << "    OatFile: " << oat_file->GetLocation()
+        << "; " << (dex2oat_cmdline != nullptr ? dex2oat_cmdline : "<not recorded>");
+  }
+}
+
 static void DumpB74410240DebugData(ArtMethod** sp) REQUIRES_SHARED(Locks::mutator_lock_) {
   // Mimick the search for the caller and dump some data while doing so.
-  LOG(FATAL_WITHOUT_ABORT) << "Dumping debugging data for b/74410240.";
+  LOG(FATAL_WITHOUT_ABORT) << "Dumping debugging data, please attach a bugreport to b/74410240.";
 
   constexpr CalleeSaveType type = CalleeSaveType::kSaveRefsAndArgs;
   CHECK_EQ(*sp, Runtime::Current()->GetCalleeSaveMethod(type));
@@ -1227,6 +1243,7 @@
       << " dex pc: " << dex_pc
       << " dex file: " << outer_method->GetDexFile()->GetLocation()
       << " class table: " << class_linker->ClassTableForClassLoader(outer_method->GetClassLoader());
+  DumpB74410240ClassData(outer_method->GetDeclaringClass());
   LOG(FATAL_WITHOUT_ABORT) << "  instruction: " << DumpInstruction(outer_method, dex_pc);
 
   ArtMethod* caller = outer_method;
@@ -1260,7 +1277,8 @@
           << " dex pc: " << dex_pc
           << " dex file: " << caller->GetDexFile()->GetLocation()
           << " class table: "
-          << class_linker->ClassTableForClassLoader(outer_method->GetClassLoader());
+          << class_linker->ClassTableForClassLoader(caller->GetClassLoader());
+      DumpB74410240ClassData(caller->GetDeclaringClass());
       LOG(FATAL_WITHOUT_ABORT) << "  instruction: " << DumpInstruction(caller, dex_pc);
     }
   }