summaryrefslogtreecommitdiff
path: root/source/Core/Section.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-10 13:44:58 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-10 13:44:58 +0000
commitf1d04915a666728c241bedb36bd99aafee3ea444 (patch)
treed63378f567f214209764be264c47c8b0814e1665 /source/Core/Section.cpp
parent60bb8ce74a67345b14fd540dd739254f562c605b (diff)
Notes
Diffstat (limited to 'source/Core/Section.cpp')
-rw-r--r--source/Core/Section.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/source/Core/Section.cpp b/source/Core/Section.cpp
index f6428ced0164..3b76dd361ff3 100644
--- a/source/Core/Section.cpp
+++ b/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());