summaryrefslogtreecommitdiffstats
path: root/libunwindstack/include/unwindstack
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2018-01-31 19:05:19 -0800
committerChristopher Ferris <cferris@google.com>2018-02-02 15:03:00 -0800
commit7747b60faa5dcfd43d920c1e60abdab1150aab32 (patch)
tree87d6249b19071be18cdb079980b09997369ada14 /libunwindstack/include/unwindstack
parent4819edf4fc15264cae0d94fbda5482b2480e99b9 (diff)
downloadsystem_core-7747b60faa5dcfd43d920c1e60abdab1150aab32.tar.gz
system_core-7747b60faa5dcfd43d920c1e60abdab1150aab32.tar.bz2
system_core-7747b60faa5dcfd43d920c1e60abdab1150aab32.zip
Load dex files from ART-specific data structure.
Fixes cdex which was recently changed to have shared data section, which means the DEX PC cannot be used to find the right symbol, as the bytecode is no longer within the dex file, and in-fact, we might have to scan multiple dex files to find the method. Bug: 72520014 Test: testrunner.py --host --cdex-none -t 137 Test: testrunner.py --host --cdex-fast -t 137 Test: All unit tests pass. Change-Id: I80265d05ad69dd9cefbe3f8a75e4cd349002af5e
Diffstat (limited to 'libunwindstack/include/unwindstack')
-rw-r--r--libunwindstack/include/unwindstack/DexFiles.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/libunwindstack/include/unwindstack/DexFiles.h b/libunwindstack/include/unwindstack/DexFiles.h
index 50c9c321e..26f5d35a3 100644
--- a/libunwindstack/include/unwindstack/DexFiles.h
+++ b/libunwindstack/include/unwindstack/DexFiles.h
@@ -23,6 +23,7 @@
#include <mutex>
#include <string>
#include <unordered_map>
+#include <vector>
namespace unwindstack {
@@ -36,19 +37,40 @@ enum ArchEnum : uint8_t;
class DexFiles {
public:
explicit DexFiles(std::shared_ptr<Memory>& memory);
+ DexFiles(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs);
~DexFiles();
DexFile* GetDexFile(uint64_t dex_file_offset, MapInfo* info);
- void GetMethodInformation(uint64_t dex_file_offset, uint64_t dex_offset, MapInfo* info,
- std::string* method_name, uint64_t* method_offset);
+ void GetMethodInformation(Maps* maps, MapInfo* info, uint64_t dex_pc, std::string* method_name,
+ uint64_t* method_offset);
void SetArch(ArchEnum arch);
private:
+ void Init(Maps* maps);
+
+ bool GetAddr(size_t index, uint64_t* addr);
+
+ uint64_t ReadEntryPtr32(uint64_t addr);
+
+ uint64_t ReadEntryPtr64(uint64_t addr);
+
+ bool ReadEntry32();
+
+ bool ReadEntry64();
+
std::shared_ptr<Memory> memory_;
- std::mutex files_lock_;
+ std::vector<std::string> search_libs_;
+
+ std::mutex lock_;
+ bool initialized_ = false;
std::unordered_map<uint64_t, DexFile*> files_;
+
+ uint64_t entry_addr_ = 0;
+ uint64_t (DexFiles::*read_entry_ptr_func_)(uint64_t) = nullptr;
+ bool (DexFiles::*read_entry_func_)() = nullptr;
+ std::vector<uint64_t> addrs_;
};
} // namespace unwindstack