diff options
author | Christopher Ferris <cferris@google.com> | 2018-11-15 14:06:26 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2018-11-15 14:06:26 -0800 |
commit | b220c645cf59b63f604e2b086013f741a58111fb (patch) | |
tree | f620406095a3c4754a5657d0e3016acecabef110 /libunwindstack/MapInfo.cpp | |
parent | 7606feb84df120375ca3a4c32f6b7b4150eec592 (diff) | |
download | unwinding-b220c645cf59b63f604e2b086013f741a58111fb.tar.gz |
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
Diffstat (limited to 'libunwindstack/MapInfo.cpp')
-rw-r--r-- | libunwindstack/MapInfo.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
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 @@ Memory* MapInfo::CreateMemory(const std::shared_ptr<Memory>& process_memory) { } } - // 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 @@ Memory* MapInfo::CreateMemory(const std::shared_ptr<Memory>& process_memory) { } } - if (ro_map_info != nullptr) { - // Make sure that relative pc values are corrected properly. - elf_offset = offset - closest_offset; + if (ro_map_info == nullptr) { + return nullptr; + } - 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)); + // Make sure that relative pc values are corrected properly. + elf_offset = offset - closest_offset; - return ranges; - } - return nullptr; + 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) { |