Log information about JITed JNI stubs in GetOatQuickMethodHeader
We added some logs to debug crashes in GetOatQuickMethodHeader.
Crashes from b/307702425 suggest that the method failing the check is a
native method. So also log JITed JNI stubs to identify the problem.
Test: art/test.py
Change-Id: I7f92f88be4fe86aa3ca1b1e5dcd83096f54113ff
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index a478ba9..6bb33a1 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -640,7 +640,8 @@
<< ", pc=" << std::hex << pc
<< ", entry_point=" << std::hex << reinterpret_cast<uintptr_t>(existing_entry_point)
<< ", copy=" << std::boolalpha << IsCopied()
- << ", proxy=" << std::boolalpha << IsProxyMethod();
+ << ", proxy=" << std::boolalpha << IsProxyMethod()
+ << ", is_native=" << std::boolalpha << IsNative();
}
}
}
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index e7e5161..845f6eb 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -1905,6 +1905,20 @@
os << meth->PrettyMethod() << "@" << std::hex
<< code_ptr << "-" << reinterpret_cast<uintptr_t>(code_ptr) + header->GetCodeSize() << '\n';
}
+ os << "JNIStubs: \n";
+ for (auto it : jni_stubs_map_) {
+ const void* code_ptr = it.second.GetCode();
+ if (code_ptr == nullptr) {
+ continue;
+ }
+ OatQuickMethodHeader* header = OatQuickMethodHeader::FromCodePointer(code_ptr);
+ os << std::hex << code_ptr << "-"
+ << reinterpret_cast<uintptr_t>(code_ptr) + header->GetCodeSize() << " ";
+ for (ArtMethod* m : it.second.GetMethods()) {
+ os << m->PrettyMethod() << ";";
+ }
+ os << "\n";
+ }
}
void JitCodeCache::PostForkChildAction(bool is_system_server, bool is_zygote) {