Remove overly restrictive check for memory.
Remove unit test that is not needed any more.
Slightly reorganize the code around the changed check.
Bug: 77958880
Test: Ran backtrace tests with new linker options.
Test: Ran libunwindstack unit tests.
Change-Id: Ie95707323fb51616a093cafb83e0343fa24e7e61
diff --git a/libunwindstack/MapInfo.cpp b/libunwindstack/MapInfo.cpp
index fe32b5e..e3b48ca 100644
--- a/libunwindstack/MapInfo.cpp
+++ b/libunwindstack/MapInfo.cpp
@@ -96,11 +96,6 @@
}
}
- // If the map isn't readable, don't bother trying to read from process memory.
- if (!(flags & PROT_READ)) {
- return nullptr;
- }
-
// Need to verify that this elf is valid. It's possible that
// only part of the elf file to be mapped into memory is in the executable
// map. In this case, there will be another read-only map that includes the
@@ -132,18 +127,19 @@
}
}
- if (ro_map_info != nullptr) {
- // Make sure that relative pc values are corrected properly.
- elf_offset = offset - closest_offset;
-
- MemoryRanges* ranges = new MemoryRanges;
- ranges->Insert(new MemoryRange(process_memory, ro_map_info->start,
- ro_map_info->end - ro_map_info->start, 0));
- ranges->Insert(new MemoryRange(process_memory, start, end - start, elf_offset));
-
- return ranges;
+ if (ro_map_info == nullptr) {
+ return nullptr;
}
- return nullptr;
+
+ // Make sure that relative pc values are corrected properly.
+ elf_offset = offset - closest_offset;
+
+ MemoryRanges* ranges = new MemoryRanges;
+ ranges->Insert(new MemoryRange(process_memory, ro_map_info->start,
+ ro_map_info->end - ro_map_info->start, 0));
+ ranges->Insert(new MemoryRange(process_memory, start, end - start, elf_offset));
+
+ return ranges;
}
Elf* MapInfo::GetElf(const std::shared_ptr<Memory>& process_memory, ArchEnum expected_arch) {