ART: Improve error message on oat writer failure
Try to log the pending exception to help resolve issues.
Bug: 16406811
Change-Id: I035ae9e59a5ee02b9e90c35c0644ec088d3c7d12
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc
index 41a91ed..680ce0a 100644
--- a/compiler/oat_writer.cc
+++ b/compiler/oat_writer.cc
@@ -527,7 +527,14 @@
NullHandle<mirror::ClassLoader>(),
NullHandle<mirror::ArtMethod>(),
invoke_type);
- CHECK(method != NULL) << PrettyMethod(it.GetMemberIndex(), *dex_file_, true);
+ if (method == nullptr) {
+ LOG(ERROR) << "Unexpected failure to resolve a method: "
+ << PrettyMethod(it.GetMemberIndex(), *dex_file_, true);
+ soa.Self()->AssertPendingException();
+ mirror::Throwable* exc = soa.Self()->GetException(nullptr);
+ std::string dump = exc->Dump();
+ LOG(FATAL) << dump;
+ }
// Portable code offsets are set by ElfWriterMclinker::FixupCompiledCodeOffset after linking.
method->SetQuickOatCodeOffset(offsets.code_offset_);
method->SetOatNativeGcMapOffset(offsets.gc_map_offset_);