diff options
Diffstat (limited to 'libunwindstack/Elf.cpp')
-rw-r--r-- | libunwindstack/Elf.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libunwindstack/Elf.cpp b/libunwindstack/Elf.cpp index edf7ac2d7..0c65895b9 100644 --- a/libunwindstack/Elf.cpp +++ b/libunwindstack/Elf.cpp | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <string.h> | 18 | #include <string.h> |
19 | 19 | ||
20 | #include <memory> | 20 | #include <memory> |
21 | #include <mutex> | ||
21 | #include <string> | 22 | #include <string> |
22 | 23 | ||
23 | #define LOG_TAG "unwind" | 24 | #define LOG_TAG "unwind" |
@@ -87,6 +88,7 @@ void Elf::InitGnuDebugdata() { | |||
87 | } | 88 | } |
88 | 89 | ||
89 | bool Elf::GetSoname(std::string* name) { | 90 | bool Elf::GetSoname(std::string* name) { |
91 | std::lock_guard<std::mutex> guard(lock_); | ||
90 | return valid_ && interface_->GetSoname(name); | 92 | return valid_ && interface_->GetSoname(name); |
91 | } | 93 | } |
92 | 94 | ||
@@ -95,6 +97,7 @@ uint64_t Elf::GetRelPc(uint64_t pc, const MapInfo* map_info) { | |||
95 | } | 97 | } |
96 | 98 | ||
97 | bool Elf::GetFunctionName(uint64_t addr, std::string* name, uint64_t* func_offset) { | 99 | bool Elf::GetFunctionName(uint64_t addr, std::string* name, uint64_t* func_offset) { |
100 | std::lock_guard<std::mutex> guard(lock_); | ||
98 | return valid_ && (interface_->GetFunctionName(addr, load_bias_, name, func_offset) || | 101 | return valid_ && (interface_->GetFunctionName(addr, load_bias_, name, func_offset) || |
99 | (gnu_debugdata_interface_ && gnu_debugdata_interface_->GetFunctionName( | 102 | (gnu_debugdata_interface_ && gnu_debugdata_interface_->GetFunctionName( |
100 | addr, load_bias_, name, func_offset))); | 103 | addr, load_bias_, name, func_offset))); |
@@ -119,6 +122,8 @@ bool Elf::Step(uint64_t rel_pc, uint64_t elf_offset, Regs* regs, Memory* process | |||
119 | } | 122 | } |
120 | rel_pc -= load_bias_; | 123 | rel_pc -= load_bias_; |
121 | 124 | ||
125 | // Lock during the step which can update information in the object. | ||
126 | std::lock_guard<std::mutex> guard(lock_); | ||
122 | return interface_->Step(rel_pc, regs, process_memory, finished) || | 127 | return interface_->Step(rel_pc, regs, process_memory, finished) || |
123 | (gnu_debugdata_interface_ && | 128 | (gnu_debugdata_interface_ && |
124 | gnu_debugdata_interface_->Step(rel_pc, regs, process_memory, finished)); | 129 | gnu_debugdata_interface_->Step(rel_pc, regs, process_memory, finished)); |