summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-06-17 01:10:58 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-06-17 01:10:58 +0000
commit259d324595172e4ad44b7c5695ab36ec5698a1ad (patch)
tree26144977e01ba500e236f244ca05cf368084a2c7
parent121798c93f8de3a6ced6b408937b7302cea448d4 (diff)
parentd03d88dc970cf5414ebeeeb7e2d1266d9dd81a87 (diff)
downloadunwinding-259d324595172e4ad44b7c5695ab36ec5698a1ad.tar.gz
Snap for 7464903 from d03d88dc970cf5414ebeeeb7e2d1266d9dd81a87 to sc-release
Change-Id: I466b46cd19305c41be0bbaa4610d34bdbaa14480
-rw-r--r--libunwindstack/DexFile.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/libunwindstack/DexFile.cpp b/libunwindstack/DexFile.cpp
index c3e53c7..e576354 100644
--- a/libunwindstack/DexFile.cpp
+++ b/libunwindstack/DexFile.cpp
@@ -89,6 +89,21 @@ std::shared_ptr<DexFile> DexFile::Create(uint64_t base_addr, uint64_t file_size,
if (!has_dex_support || file_size == 0) {
return nullptr;
}
+
+ // Do not try to open the DEX file if the file name ends with "(deleted)". It does not exist.
+ // This happens when an app is background-optimized by ART and all of its files are replaced.
+ // Furthermore, do NOT try to fallback to in-memory copy. It would work, but all apps tend to
+ // be background-optimized at the same time, so it would lead to excessive memory use during
+ // system-wide profiling (essentially copying all dex files for all apps: hundreds of MBs).
+ // This will cause missing symbols in the backtrace, however, that outcome is inevitable
+ // anyway, since we can not obtain mini-debug-info for the deleted .oat files.
+ const std::string_view filename(info != nullptr ? info->name() : "");
+ const std::string_view kDeleted("(deleted)");
+ if (filename.size() >= kDeleted.size() &&
+ filename.substr(filename.size() - kDeleted.size()) == kDeleted) {
+ return nullptr;
+ }
+
std::shared_ptr<DexFile> dex_file = CreateFromDisk(base_addr, file_size, info);
if (dex_file != nullptr) {
return dex_file;