diff options
author | David Srbecky <dsrbecky@google.com> | 2019-04-05 18:23:32 +0000 |
---|---|---|
committer | David Srbecky <dsrbecky@google.com> | 2019-04-05 18:23:32 +0000 |
commit | 0b80d3372c5f42475394f8623b2c3ef4bdb6bac9 (patch) | |
tree | 2cb79f348bfd3356b8c07c7b889f8537f1d967bb /libunwindstack/include/unwindstack/JitDebug.h | |
parent | 91dc724d5ba73d60cc0f7c2b01e559e899ff3a87 (diff) | |
download | unwinding-0b80d3372c5f42475394f8623b2c3ef4bdb6bac9.tar.gz |
Revert "Check for data races when reading JIT/DEX entries."
This reverts commit 91dc724d5ba73d60cc0f7c2b01e559e899ff3a87.
Reason for revert: Breaks ART tests, reverting to investigate.
Change-Id: I1bb905407e87cbd4f832646651133a9caf6fcfc8
Diffstat (limited to 'libunwindstack/include/unwindstack/JitDebug.h')
-rw-r--r-- | libunwindstack/include/unwindstack/JitDebug.h | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/libunwindstack/include/unwindstack/JitDebug.h b/libunwindstack/include/unwindstack/JitDebug.h index 0c3ded9..8b7b4b5 100644 --- a/libunwindstack/include/unwindstack/JitDebug.h +++ b/libunwindstack/include/unwindstack/JitDebug.h @@ -19,7 +19,6 @@ #include <stdint.h> -#include <map> #include <memory> #include <mutex> #include <string> @@ -31,24 +30,40 @@ namespace unwindstack { // Forward declarations. +class Elf; class Maps; enum ArchEnum : uint8_t; -template <typename Symfile> -class JitDebug { +class JitDebug : public Global { public: - static std::unique_ptr<JitDebug> Create(ArchEnum arch, std::shared_ptr<Memory>& memory, - std::vector<std::string> search_libs = {}); - virtual ~JitDebug() {} - - // Find symbol file for given pc. - virtual Symfile* Get(Maps* maps, uint64_t pc) = 0; - - // Find symbol for given pc. - bool GetFunctionName(Maps* maps, uint64_t pc, std::string* name, uint64_t* offset) { - Symfile* file = Get(maps, pc); - return file != nullptr && file->GetFunctionName(pc, name, offset); - } + explicit JitDebug(std::shared_ptr<Memory>& memory); + JitDebug(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs); + virtual ~JitDebug(); + + Elf* GetElf(Maps* maps, uint64_t pc); + + private: + void Init(Maps* maps); + + uint64_t (JitDebug::*read_descriptor_func_)(uint64_t) = nullptr; + uint64_t (JitDebug::*read_entry_func_)(uint64_t*, uint64_t*) = nullptr; + + uint64_t ReadDescriptor32(uint64_t); + uint64_t ReadDescriptor64(uint64_t); + + uint64_t ReadEntry32Pack(uint64_t* start, uint64_t* size); + uint64_t ReadEntry32Pad(uint64_t* start, uint64_t* size); + uint64_t ReadEntry64(uint64_t* start, uint64_t* size); + + bool ReadVariableData(uint64_t ptr_offset) override; + + void ProcessArch() override; + + uint64_t entry_addr_ = 0; + bool initialized_ = false; + std::vector<Elf*> elf_list_; + + std::mutex lock_; }; } // namespace unwindstack |