diff options
author | Ian Rogers <irogers@google.com> | 2013-10-13 10:44:14 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2013-10-21 17:01:11 -0700 |
commit | 8d31bbd3d6536de12bc20e3d29cfe03fe848f9da (patch) | |
tree | 2373ae08ddddaf1034623df85d647ecf9ac6c831 /oatdump | |
parent | 57e6d8a99058e5c74d5244b68a5f4d53526fa108 (diff) | |
download | art-8d31bbd3d6536de12bc20e3d29cfe03fe848f9da.zip art-8d31bbd3d6536de12bc20e3d29cfe03fe848f9da.tar.gz art-8d31bbd3d6536de12bc20e3d29cfe03fe848f9da.tar.bz2 |
Throw IOException at source of failing to open a dex file.
Before is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more
And after is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.io.IOException: Zip archive '/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar' doesn't contain classes.dex
at dalvik.system.DexFile.openDexFile(Native Method)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexFile.<init>(DexFile.java:59)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:268)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:235)
at dalvik.system.DexPathList.<init>(DexPathList.java:113)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:38)
at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:128)
at java.lang.ClassLoader.access$000(ClassLoader.java:65)
at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:137)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more
Also, move dex file verifier messages out of logs.
In the process the ClassLinker::dex_lock_ needed tidying to cover a smaller
scope. Bug 11301553.
Change-Id: I80058652e11e7ea63457cc01a0cb48afe1c15543
Diffstat (limited to 'oatdump')
-rw-r--r-- | oatdump/oatdump.cc | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index 6db5813..ea06b02 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -173,9 +173,13 @@ class OatDumper { MethodHelper mh(m); for (size_t i = 0; i < oat_dex_files_.size(); i++) { const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i]; - CHECK(oat_dex_file != NULL); - UniquePtr<const DexFile> dex_file(oat_dex_file->OpenDexFile()); - if (dex_file.get() != NULL) { + CHECK(oat_dex_file != nullptr); + std::string error_msg; + UniquePtr<const DexFile> dex_file(oat_dex_file->OpenDexFile(&error_msg)); + if (dex_file.get() == nullptr) { + LOG(WARNING) << "Failed to open dex file '" << oat_dex_file->GetDexFileLocation() + << "': " << error_msg; + } else { const DexFile::ClassDef* class_def = dex_file->FindClassDef(mh.GetDeclaringClassDescriptor()); if (class_def != NULL) { @@ -199,8 +203,11 @@ class OatDumper { for (size_t i = 0; i < oat_dex_files_.size(); i++) { const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i]; CHECK(oat_dex_file != NULL); - UniquePtr<const DexFile> dex_file(oat_dex_file->OpenDexFile()); - if (dex_file.get() == NULL) { + std::string error_msg; + UniquePtr<const DexFile> dex_file(oat_dex_file->OpenDexFile(&error_msg)); + if (dex_file.get() == nullptr) { + LOG(WARNING) << "Failed to open dex file '" << oat_dex_file->GetDexFileLocation() + << "': " << error_msg; continue; } offsets_.insert(reinterpret_cast<uint32_t>(&dex_file->GetHeader())); @@ -245,9 +252,10 @@ class OatDumper { os << "OAT DEX FILE:\n"; os << StringPrintf("location: %s\n", oat_dex_file.GetDexFileLocation().c_str()); os << StringPrintf("checksum: 0x%08x\n", oat_dex_file.GetDexFileLocationChecksum()); - UniquePtr<const DexFile> dex_file(oat_dex_file.OpenDexFile()); + std::string error_msg; + UniquePtr<const DexFile> dex_file(oat_dex_file.OpenDexFile(&error_msg)); if (dex_file.get() == NULL) { - os << "NOT FOUND\n\n"; + os << "NOT FOUND: " << error_msg << "\n\n"; return; } for (size_t class_def_index = 0; class_def_index < dex_file->NumClassDefs(); class_def_index++) { @@ -727,9 +735,10 @@ class ImageDumper { os << " (" << oat_location << ")"; } os << "\n"; - const OatFile* oat_file = class_linker->FindOatFileFromOatLocation(oat_location); + std::string error_msg; + const OatFile* oat_file = class_linker->FindOatFileFromOatLocation(oat_location, &error_msg); if (oat_file == NULL) { - os << "NOT FOUND\n"; + os << "NOT FOUND: " << error_msg << "\n"; return; } os << "\n"; @@ -775,7 +784,7 @@ class ImageDumper { os << "STATS:\n" << std::flush; UniquePtr<File> file(OS::OpenFileForReading(image_filename_.c_str())); if (file.get() == NULL) { - std::string cache_location(GetDalvikCacheFilenameOrDie(image_filename_)); + std::string cache_location(GetDalvikCacheFilenameOrDie(image_filename_.c_str())); file.reset(OS::OpenFileForReading(cache_location.c_str())); if (file.get() == NULL) { LOG(WARNING) << "Failed to find image in " << image_filename_ @@ -1412,10 +1421,11 @@ static int oatdump(int argc, char** argv) { } if (oat_filename != NULL) { + std::string error_msg; OatFile* oat_file = - OatFile::Open(oat_filename, oat_filename, NULL, false); + OatFile::Open(oat_filename, oat_filename, NULL, false, &error_msg); if (oat_file == NULL) { - fprintf(stderr, "Failed to open oat file from %s\n", oat_filename); + fprintf(stderr, "Failed to open oat file from '%s': %s\n", oat_filename, error_msg.c_str()); return EXIT_FAILURE; } OatDumper oat_dumper(*host_prefix.get(), *oat_file); |