diff options
author | Christopher Ferris <cferris@google.com> | 2018-10-17 10:57:53 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2018-10-17 14:23:10 -0700 |
commit | 718b0d3abfd16d2932129dfff4ed1bcde5bfe521 (patch) | |
tree | 5bcf6f26a85b4159f9bbdc1e82c7c27960efcfbf /libunwindstack/include/unwindstack/JitDebug.h | |
parent | da9eb7572b6fc0dc3be67af7bdefcbc0febef248 (diff) | |
download | unwinding-718b0d3abfd16d2932129dfff4ed1bcde5bfe521.tar.gz |
Fix which maps to search for globals.
If multiple threads are unwinding at the same time, new maps that contain
the global variables for dex files and jit information are created. This
leads to threads creating more new maps that then get searched, then
more maps, then more searching until virtual address space exhaustion.
Fix this so that we only search maps that have a corresponding rw map that
could contain the global memory.
Small refactor to combine the code to search for global variables into
one class that both classes inherit from.
Modify unit tests for the new pattern checking.
Bug: 117761427
Test: Ran unit tests for libunwindstack/libbacktrace/simpleperf.
Test: Ran art 004-ThreadStress that used to fail.
Change-Id: I837ca6b9d0383100079de090bc7d019598e0cdfe
Diffstat (limited to 'libunwindstack/include/unwindstack/JitDebug.h')
-rw-r--r-- | libunwindstack/include/unwindstack/JitDebug.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libunwindstack/include/unwindstack/JitDebug.h b/libunwindstack/include/unwindstack/JitDebug.h index 0bcd0b0..ccb473f 100644 --- a/libunwindstack/include/unwindstack/JitDebug.h +++ b/libunwindstack/include/unwindstack/JitDebug.h @@ -24,15 +24,17 @@ #include <string> #include <vector> +#include <unwindstack/Global.h> +#include <unwindstack/Memory.h> + namespace unwindstack { // Forward declarations. class Elf; class Maps; -class Memory; enum ArchEnum : uint8_t; -class JitDebug { +class JitDebug : public Global { public: explicit JitDebug(std::shared_ptr<Memory>& memory); JitDebug(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs); @@ -45,11 +47,9 @@ class JitDebug { private: void Init(Maps* maps); - std::shared_ptr<Memory> memory_; uint64_t entry_addr_ = 0; bool initialized_ = false; std::vector<Elf*> elf_list_; - std::vector<std::string> search_libs_; std::mutex lock_; @@ -62,6 +62,8 @@ class JitDebug { 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; }; } // namespace unwindstack |