summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Section.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-06-08 13:26:35 +0000
committerPavel Labath <labath@google.com>2017-06-08 13:26:35 +0000
commitc3c721222d3ca702ebe14ebc487a7feced6c36c1 (patch)
tree8736e1b3e627c0cfb652ab597442c339a37b23cc /lldb/source/Core/Section.cpp
parent62fb8498d32ae76c316437c7429095dad6873a82 (diff)
downloadbcm5719-llvm-c3c721222d3ca702ebe14ebc487a7feced6c36c1.tar.gz
bcm5719-llvm-c3c721222d3ca702ebe14ebc487a7feced6c36c1.zip
Fix backtrace of noreturn functions situated at the end of a module
Summary: When a call instruction is the last instruction in a function, the backtrace PC will point past the end of the function. We already had special code to handle that, but we did not handle the case where the PC ends up outside of the bounds of the module containing the function, which is a situation that occured in TestNoreturnUnwind on android for some arch/compiler combinations. I fix this by adding an argument to Address resolution code which states that we are ok with addresses pointing to the end of a module/section to resolve to that module/section. I create a reproducible test case for this situation by hand-crafting an executable which has a noreturn function at the end of a module. Reviewers: jasonmolenda, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D32022 llvm-svn: 304976
Diffstat (limited to 'lldb/source/Core/Section.cpp')
-rw-r--r--lldb/source/Core/Section.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index f6428ced016..3b76dd361ff 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -220,18 +220,18 @@ addr_t Section::GetLoadBaseAddress(Target *target) const {
return load_base_addr;
}
-bool Section::ResolveContainedAddress(addr_t offset, Address &so_addr) const {
+bool Section::ResolveContainedAddress(addr_t offset, Address &so_addr,
+ bool allow_section_end) const {
const size_t num_children = m_children.GetSize();
- if (num_children > 0) {
- for (size_t i = 0; i < num_children; i++) {
- Section *child_section = m_children.GetSectionAtIndex(i).get();
-
- addr_t child_offset = child_section->GetOffset();
- if (child_offset <= offset &&
- offset - child_offset < child_section->GetByteSize())
- return child_section->ResolveContainedAddress(offset - child_offset,
- so_addr);
- }
+ for (size_t i = 0; i < num_children; i++) {
+ Section *child_section = m_children.GetSectionAtIndex(i).get();
+
+ addr_t child_offset = child_section->GetOffset();
+ if (child_offset <= offset &&
+ offset - child_offset <
+ child_section->GetByteSize() + (allow_section_end ? 1 : 0))
+ return child_section->ResolveContainedAddress(offset - child_offset,
+ so_addr, allow_section_end);
}
so_addr.SetOffset(offset);
so_addr.SetSection(const_cast<Section *>(this)->shared_from_this());
OpenPOWER on IntegriCloud