diff options
author | Brian Carlstrom <bdc@google.com> | 2014-09-10 10:08:37 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2014-09-11 13:08:13 -0700 |
commit | 3c821c67e28ee1ec7bea2b3b644f5aed303f19f3 (patch) | |
tree | cf9f9cf4f2bbef75683ca195ecabcc02b7888281 /runtime/well_known_classes.cc | |
parent | a68b478fbc6ca8d445a3befc7eb8ca58586294eb (diff) | |
download | art-3c821c67e28ee1ec7bea2b3b644f5aed303f19f3.zip art-3c821c67e28ee1ec7bea2b3b644f5aed303f19f3.tar.gz art-3c821c67e28ee1ec7bea2b3b644f5aed303f19f3.tar.bz2 |
Add DumpClass context on CacheField and CacheMethod failures
Change-Id: Ia1992d98c998cdc98896f5912da50c4849de7699
Diffstat (limited to 'runtime/well_known_classes.cc')
-rw-r--r-- | runtime/well_known_classes.cc | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/runtime/well_known_classes.cc b/runtime/well_known_classes.cc index 6b67dfa..cef604b 100644 --- a/runtime/well_known_classes.cc +++ b/runtime/well_known_classes.cc @@ -21,6 +21,7 @@ #include "base/logging.h" #include "mirror/class.h" #include "ScopedLocalRef.h" +#include "scoped_thread_state_change.h" #include "thread-inl.h" namespace art { @@ -122,18 +123,32 @@ static jclass CacheClass(JNIEnv* env, const char* jni_class_name) { return reinterpret_cast<jclass>(env->NewGlobalRef(c.get())); } -static jfieldID CacheField(JNIEnv* env, jclass c, bool is_static, const char* name, const char* signature) { - jfieldID fid = is_static ? env->GetStaticFieldID(c, name, signature) : env->GetFieldID(c, name, signature); +static jfieldID CacheField(JNIEnv* env, jclass c, bool is_static, + const char* name, const char* signature) { + jfieldID fid = (is_static ? + env->GetStaticFieldID(c, name, signature) : + env->GetFieldID(c, name, signature)); if (fid == NULL) { - LOG(FATAL) << "Couldn't find field \"" << name << "\" with signature \"" << signature << "\""; + ScopedObjectAccess soa(env); + std::ostringstream os; + WellKnownClasses::ToClass(c)->DumpClass(os, mirror::Class::kDumpClassFullDetail); + LOG(FATAL) << "Couldn't find field \"" << name << "\" with signature \"" << signature << "\": " + << os.str(); } return fid; } -jmethodID CacheMethod(JNIEnv* env, jclass c, bool is_static, const char* name, const char* signature) { - jmethodID mid = is_static ? env->GetStaticMethodID(c, name, signature) : env->GetMethodID(c, name, signature); +jmethodID CacheMethod(JNIEnv* env, jclass c, bool is_static, + const char* name, const char* signature) { + jmethodID mid = (is_static ? + env->GetStaticMethodID(c, name, signature) : + env->GetMethodID(c, name, signature)); if (mid == NULL) { - LOG(FATAL) << "Couldn't find method \"" << name << "\" with signature \"" << signature << "\""; + ScopedObjectAccess soa(env); + std::ostringstream os; + WellKnownClasses::ToClass(c)->DumpClass(os, mirror::Class::kDumpClassFullDetail); + LOG(FATAL) << "Couldn't find method \"" << name << "\" with signature \"" << signature << "\": " + << os.str(); } return mid; } |