diff options
author | 2025-02-12 11:51:00 -0800 | |
---|---|---|
committer | 2025-02-13 07:54:00 -0800 | |
commit | f937d3d23083efc167ff68b41216373bffd23c95 (patch) | |
tree | 964b758b403e573e022de13e1dbc8cbe8dbe1331 | |
parent | a334d1c7100f7d6260984a8b8708271f9a8c84b9 (diff) |
s/oat_location/oat_filename/ when opening an oat file
VMDebug_getExecutableMethodFileOffsetsNative includes the output of OatFile::GetLocation() in its return value and this location is supposed to point to the actual file on device. However, the existing code returns an nonexistent path like /system/framework/boot-framework.oat, whereas the actual file is located under /system/framework/arm64.
This change fixes the issue by passing the actual file path as oat location into OatFile. This way OatFile::GetLocation() would return the actual path.
Bug: 395993265
Test: atest uprobestats-test
Change-Id: I072298a4078c9bf1b89fc71e5ab7148e8b56114c
-rw-r--r-- | runtime/gc/space/image_space.cc | 6 | ||||
-rw-r--r-- | runtime/native/dalvik_system_DexFile.cc | 3 |
2 files changed, 3 insertions, 6 deletions
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc index d28a534440..f236d2a5d7 100644 --- a/runtime/gc/space/image_space.cc +++ b/runtime/gc/space/image_space.cc @@ -2872,14 +2872,12 @@ class ImageSpace::BootImageLoader { TimingLogger::ScopedTiming timing("OpenOatFile", logger); std::string oat_filename = ImageHeader::GetOatLocationFromImageLocation(space->GetImageFilename()); - std::string oat_location = - ImageHeader::GetOatLocationFromImageLocation(space->GetImageLocation()); DCHECK_EQ(vdex_fd.get() != -1, oat_fd.get() != -1); if (vdex_fd.get() == -1) { oat_file.reset(OatFile::Open(/*zip_fd=*/-1, oat_filename, - oat_location, + oat_filename, executable_, /*low_4gb=*/false, dex_filenames, @@ -2890,7 +2888,7 @@ class ImageSpace::BootImageLoader { oat_file.reset(OatFile::Open(/*zip_fd=*/-1, vdex_fd.get(), oat_fd.get(), - oat_location, + oat_filename, executable_, /*low_4gb=*/false, dex_filenames, diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc index f7354dbf36..da5fe5f0f2 100644 --- a/runtime/native/dalvik_system_DexFile.cc +++ b/runtime/native/dalvik_system_DexFile.cc @@ -883,8 +883,7 @@ static jobjectArray DexFile_getDexFileOutputPaths(JNIEnv* env, for (const OatDexFile* oat_dex_file : oat_dex_files) { if (DexFileLoader::GetBaseLocation(oat_dex_file->GetDexFileLocation()) == filename.c_str()) { - oat_filename = GetSystemImageFilename(oat_file->GetLocation().c_str(), - target_instruction_set); + oat_filename = oat_file->GetLocation(); is_vdex_only = oat_file->IsBackedByVdexOnly(); break; } |