summaryrefslogtreecommitdiff
path: root/libunwindstack/MapInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libunwindstack/MapInfo.cpp')
-rw-r--r--libunwindstack/MapInfo.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libunwindstack/MapInfo.cpp b/libunwindstack/MapInfo.cpp
index 8527797d2..fe32b5e34 100644
--- a/libunwindstack/MapInfo.cpp
+++ b/libunwindstack/MapInfo.cpp
@@ -146,7 +146,7 @@ Memory* MapInfo::CreateMemory(const std::shared_ptr<Memory>& process_memory) {
return nullptr;
}
-Elf* MapInfo::GetElf(const std::shared_ptr<Memory>& process_memory) {
+Elf* MapInfo::GetElf(const std::shared_ptr<Memory>& process_memory, ArchEnum expected_arch) {
// Make sure no other thread is trying to add the elf to this map.
std::lock_guard<std::mutex> guard(mutex_);
@@ -176,6 +176,10 @@ Elf* MapInfo::GetElf(const std::shared_ptr<Memory>& process_memory) {
// If the init fails, keep the elf around as an invalid object so we
// don't try to reinit the object.
elf->Init();
+ if (elf->valid() && expected_arch != elf->arch()) {
+ // Make the elf invalid, mismatch between arch and expected arch.
+ elf->Invalidate();
+ }
if (locked) {
Elf::CacheAdd(this);