diff options
| -rw-r--r-- | runtime/dex_file.cc | 14 | ||||
| -rw-r--r-- | runtime/entrypoints/quick/quick_throw_entrypoints.cc | 1 | ||||
| -rw-r--r-- | runtime/mirror/object_test.cc | 17 | ||||
| -rw-r--r-- | runtime/mirror/string.cc | 3 | ||||
| -rw-r--r-- | runtime/native/dalvik_system_DexFile.cc | 10 | ||||
| -rw-r--r-- | runtime/reflection.cc | 7 | ||||
| -rw-r--r-- | runtime/thread.cc | 4 |
7 files changed, 41 insertions, 15 deletions
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index 4fd9a608c1..f824dd77b0 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -353,27 +353,41 @@ uint32_t DexFile::GetVersion() const { void DexFile::InitIndex() { CHECK_EQ(index_.size(), 0U) << GetLocation(); +bool debug_file = (GetLocation() == "/data/app/com.eclipsim.gpsstatus2-1.apk"); for (size_t i = 0; i < NumClassDefs(); ++i) { const ClassDef& class_def = GetClassDef(i); const char* descriptor = GetClassDescriptor(class_def); +bool debug_log = (strcmp(descriptor, "Lo/coN;") == 0); +if (debug_log) { LG << this << " XXX bdc DexFile::InitIndex " << GetLocation() << " i=" << i << " descriptor=" << descriptor << " strlen(descriptor)=" << strlen(descriptor); } index_.Put(descriptor, i); } +if (debug_file) { LG << this << " XXX bdc DexFile::InitIndex " << GetLocation() << " index_.size()=" << index_.size(); } } bool DexFile::FindClassDefIndex(const StringPiece& descriptor, uint32_t& idx) const { +bool debug_file = (GetLocation() == "/data/app/com.eclipsim.gpsstatus2-1.apk"); +bool debug_log = (descriptor == "Lo/coN;"); Index::const_iterator it = index_.find(descriptor); if (it == index_.end()) { +if (debug_log) { LG << this << " XXX bdc DexFile::FindClassDefIndex(" << descriptor << ") => false debug_log=" << debug_log << " descriptor.size()=" << descriptor.size() << " " << strlen("Lo/coN;"); } +if (debug_file) { LG << this << " XXX bdc DexFile::FindClassDefIndex " << GetLocation() << " index_.size()=" << index_.size(); } return false; } idx = it->second; +if (debug_log) { LG << this << " XXX bdc DexFile::FindClassDefIndex(" << descriptor << ") => true idx=" << idx; } return true; } const DexFile::ClassDef* DexFile::FindClassDef(const StringPiece& descriptor) const { uint32_t idx; +bool debug_file = (GetLocation() == "/data/app/com.eclipsim.gpsstatus2-1.apk"); +bool debug_log = (descriptor == "Lo/coN;"); if (FindClassDefIndex(descriptor, idx)) { +if (debug_log) { LG << this << " XXX bdc DexFile::FindClassDef(" << descriptor << ") => success"; } return &GetClassDef(idx); } +if (debug_log) { LG << this << " XXX bdc DexFile::FindClassDef(" << descriptor << ") => NULL debug_log=" << debug_log << " descriptor.size()=" << descriptor.size() << " " << strlen("Lo/coN;"); } +if (debug_file) { LG << this << " XXX bdc DexFile::FindClassDef " << GetLocation() << " index_.size()=" << index_.size(); } return NULL; } diff --git a/runtime/entrypoints/quick/quick_throw_entrypoints.cc b/runtime/entrypoints/quick/quick_throw_entrypoints.cc index f67b2fc4ab..2b060f80a8 100644 --- a/runtime/entrypoints/quick/quick_throw_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_throw_entrypoints.cc @@ -58,6 +58,7 @@ extern "C" void artThrowNullPointerExceptionFromCode(Thread* self, SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kSaveAll); ThrowLocation throw_location = self->GetCurrentLocationForThrow(); + LG << "artThrowNullPointerExceptionFromCode GetDexPc=0x" << std::hex << throw_location.GetDexPc(); ThrowNullPointerExceptionFromDexPC(throw_location); self->QuickDeliverException(); } diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc index 814305c3af..b8765afadc 100644 --- a/runtime/mirror/object_test.cc +++ b/runtime/mirror/object_test.cc @@ -42,26 +42,27 @@ namespace mirror { class ObjectTest : public CommonTest { protected: - void AssertString(int32_t length, + void AssertString(int32_t expected_utf16_length, const char* utf8_in, const char* utf16_expected_le, int32_t expected_hash) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - UniquePtr<uint16_t[]> utf16_expected(new uint16_t[length]); - for (int32_t i = 0; i < length; i++) { + UniquePtr<uint16_t[]> utf16_expected(new uint16_t[expected_utf16_length]); + for (int32_t i = 0; i < expected_utf16_length; i++) { uint16_t ch = (((utf16_expected_le[i*2 + 0] & 0xff) << 8) | ((utf16_expected_le[i*2 + 1] & 0xff) << 0)); utf16_expected[i] = ch; } Thread* self = Thread::Current(); - SirtRef<String> string(self, String::AllocFromModifiedUtf8(self, length, utf8_in)); - ASSERT_EQ(length, string->GetLength()); + SirtRef<String> string(self, String::AllocFromModifiedUtf8(self, expected_utf16_length, utf8_in)); + ASSERT_EQ(expected_utf16_length, string->GetLength()); ASSERT_TRUE(string->GetCharArray() != NULL); ASSERT_TRUE(string->GetCharArray()->GetData() != NULL); - // strlen is necessary because the 1-character string "\0" is interpreted as "" - ASSERT_TRUE(string->Equals(utf8_in) || length != static_cast<int32_t>(strlen(utf8_in))); - for (int32_t i = 0; i < length; i++) { + // strlen is necessary because the 1-character string "\x00\x00" is interpreted as "" + ASSERT_TRUE(string->Equals(utf8_in) || (expected_utf16_length == 1 && strlen(utf8_in) == 0)); + ASSERT_TRUE(string->Equals(StringPiece(utf8_in)) || (expected_utf16_length == 1 && strlen(utf8_in) == 0)); + for (int32_t i = 0; i < expected_utf16_length; i++) { EXPECT_EQ(utf16_expected[i], string->CharAt(i)); } EXPECT_EQ(expected_hash, string->GetHashCode()); diff --git a/runtime/mirror/string.cc b/runtime/mirror/string.cc index 54ba3b01c6..f8a0e531eb 100644 --- a/runtime/mirror/string.cc +++ b/runtime/mirror/string.cc @@ -224,9 +224,6 @@ bool String::Equals(const char* modified_utf8) const { } bool String::Equals(const StringPiece& modified_utf8) const { - if (modified_utf8.size() != GetLength()) { - return false; - } const char* p = modified_utf8.data(); for (int32_t i = 0; i < GetLength(); ++i) { uint16_t ch = GetUtf16FromUtf8(&p); diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc index 2f4e427bb6..a5eaad6847 100644 --- a/runtime/native/dalvik_system_DexFile.cc +++ b/runtime/native/dalvik_system_DexFile.cc @@ -142,17 +142,20 @@ static jclass DexFile_defineClassNative(JNIEnv* env, jclass, jstring javaName, j const DexFile* dex_file = toDexFile(cookie); if (dex_file == NULL) { VLOG(class_linker) << "Failed to find dex_file"; + LG << "XXX bdc Failed to find dex_file"; return NULL; } ScopedUtfChars class_name(env, javaName); if (class_name.c_str() == NULL) { - VLOG(class_linker) << "Failed to find class_name"; + VLOG(class_linker) << "Failed to find class_name to lookup in " << dex_file->GetLocation(); + LG << "XXX bdc Failed to find class_name to lookup in " << dex_file->GetLocation(); return NULL; } const std::string descriptor(DotToDescriptor(class_name.c_str())); const DexFile::ClassDef* dex_class_def = dex_file->FindClassDef(descriptor); if (dex_class_def == NULL) { - VLOG(class_linker) << "Failed to find dex_class_def"; + VLOG(class_linker) << "Failed to find dex_class_def " << descriptor << " in " << dex_file->GetLocation(); + LG << dex_file << " XXX bdc Failed to find dex_class_def " << descriptor << " in " << dex_file->GetLocation(); return NULL; } ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); @@ -160,7 +163,8 @@ static jclass DexFile_defineClassNative(JNIEnv* env, jclass, jstring javaName, j mirror::ClassLoader* class_loader = soa.Decode<mirror::ClassLoader*>(javaLoader); mirror::Class* result = class_linker->DefineClass(descriptor.c_str(), class_loader, *dex_file, *dex_class_def); - VLOG(class_linker) << "DexFile_defineClassNative returning " << result; + VLOG(class_linker) << "DexFile_defineClassNative for " << " in " << dex_file->GetLocation() << descriptor << " returning " << result; + LG << dex_file << " XXX bdc DexFile_defineClassNative for " << descriptor << " in " << dex_file->GetLocation() << " returning " << result; return soa.AddLocalReference<jclass>(result); } diff --git a/runtime/reflection.cc b/runtime/reflection.cc index 3e58b4bd94..5e44a4c256 100644 --- a/runtime/reflection.cc +++ b/runtime/reflection.cc @@ -38,6 +38,13 @@ jobject InvokeMethod(const ScopedObjectAccess& soa, jobject javaMethod, jobject jmethodID mid = soa.Env()->FromReflectedMethod(javaMethod); mirror::ArtMethod* m = soa.DecodeMethod(mid); + std::string pretty_descriptor(PrettyDescriptor(m->GetDeclaringClass())); + if (true || + StartsWith(pretty_descriptor, "Lcom/eclipsim/gpsstatus2/") || + StartsWith(pretty_descriptor, "Lo/")) { + LG << "XXX bdc InvokeMethod reflectively calling " << PrettyMethod(m); + } + mirror::Class* declaring_class = m->GetDeclaringClass(); if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(declaring_class, true, true)) { return NULL; diff --git a/runtime/thread.cc b/runtime/thread.cc index a454195316..26b9c3130e 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -819,7 +819,8 @@ struct StackDumpVisitor : public StackVisitor { mh.ChangeMethod(m); const char* source_file(mh.GetDeclaringClassSourceFile()); os << "(" << (source_file != NULL ? source_file : "unavailable") - << ":" << line_number << ")"; + << ":" << line_number << ")" + << " <0x" << std::hex << GetDexPc() << ">"; } os << "\n"; if (frame_count == 0) { @@ -1921,6 +1922,7 @@ void Thread::QuickDeliverException() { ThrowLocation throw_location; mirror::Throwable* exception = GetException(&throw_location); CHECK(exception != NULL); + LG << "XXX bdc QuickDeliverException " << PrettyMethod(throw_location.GetMethod()) << " " << std::hex << throw_location.GetDexPc(); // Don't leave exception visible while we try to find the handler, which may cause class // resolution. ClearException(); |