diff options
author | Christopher Ferris <cferris@google.com> | 2021-06-17 16:43:00 +0000 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2021-06-17 16:43:00 +0000 |
commit | 0edbb36b9b912567a78bce2b5cd968205f0c6f6e (patch) | |
tree | 26144977e01ba500e236f244ca05cf368084a2c7 | |
parent | 7cb7fd05e3e02c0473fda317c11080e21bfa882e (diff) | |
download | unwinding-0edbb36b9b912567a78bce2b5cd968205f0c6f6e.tar.gz |
Revert "Remove CheckDexSupport check."
This reverts commit 7cb7fd05e3e02c0473fda317c11080e21bfa882e.
Reason for revert: libdex_support lib does actually dlopen real library.
Bug: 191276623
Change-Id: Ie47f17999c70ca9e61f380b879ea70452b2e0895
-rw-r--r-- | libunwindstack/DexFile.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libunwindstack/DexFile.cpp b/libunwindstack/DexFile.cpp index 15a814d..e576354 100644 --- a/libunwindstack/DexFile.cpp +++ b/libunwindstack/DexFile.cpp @@ -39,6 +39,14 @@ namespace unwindstack { std::map<DexFile::MappedFileKey, std::weak_ptr<DexFile::DexFileApi>> DexFile::g_mapped_dex_files; std::mutex DexFile::g_lock; +static bool CheckDexSupport() { + if (std::string err_msg; !art_api::dex::TryLoadLibdexfile(&err_msg)) { + ALOGW("Failed to initialize DEX file support: %s", err_msg.c_str()); + return false; + } + return true; +} + std::shared_ptr<DexFile> DexFile::CreateFromDisk(uint64_t addr, uint64_t size, MapInfo* map) { if (map == nullptr || map->name().empty()) { return nullptr; // MapInfo not backed by file. @@ -77,7 +85,8 @@ std::shared_ptr<DexFile> DexFile::CreateFromDisk(uint64_t addr, uint64_t size, M std::shared_ptr<DexFile> DexFile::Create(uint64_t base_addr, uint64_t file_size, Memory* memory, MapInfo* info) { - if (file_size == 0) { + static bool has_dex_support = CheckDexSupport(); + if (!has_dex_support || file_size == 0) { return nullptr; } |