diff options
Diffstat (limited to 'source/Core')
-rw-r--r-- | source/Core/Address.cpp | 12 | ||||
-rw-r--r-- | source/Core/ArchSpec.cpp | 8 | ||||
-rw-r--r-- | source/Core/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/Core/Section.cpp | 22 |
4 files changed, 23 insertions, 20 deletions
diff --git a/source/Core/Address.cpp b/source/Core/Address.cpp index 6328e433852a0..0c929c22f75f6 100644 --- a/source/Core/Address.cpp +++ b/source/Core/Address.cpp @@ -361,8 +361,9 @@ addr_t Address::GetOpcodeLoadAddress(Target *target, } bool Address::SetOpcodeLoadAddress(lldb::addr_t load_addr, Target *target, - AddressClass addr_class) { - if (SetLoadAddress(load_addr, target)) { + AddressClass addr_class, + bool allow_section_end) { + if (SetLoadAddress(load_addr, target, allow_section_end)) { if (target) { if (addr_class == eAddressClassInvalid) addr_class = GetAddressClass(); @@ -1001,9 +1002,10 @@ AddressClass Address::GetAddressClass() const { return eAddressClassUnknown; } -bool Address::SetLoadAddress(lldb::addr_t load_addr, Target *target) { - if (target && - target->GetSectionLoadList().ResolveLoadAddress(load_addr, *this)) +bool Address::SetLoadAddress(lldb::addr_t load_addr, Target *target, + bool allow_section_end) { + if (target && target->GetSectionLoadList().ResolveLoadAddress( + load_addr, *this, allow_section_end)) return true; m_section_wp.reset(); m_offset = load_addr; diff --git a/source/Core/ArchSpec.cpp b/source/Core/ArchSpec.cpp index 91b73847ac1f3..bfe9750f70f05 100644 --- a/source/Core/ArchSpec.cpp +++ b/source/Core/ArchSpec.cpp @@ -24,11 +24,11 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Twine.h" // for Twine -#include "llvm/Support/COFF.h" -#include "llvm/Support/Compiler.h" // for LLVM_FALLTHROUGH -#include "llvm/Support/ELF.h" +#include "llvm/BinaryFormat/COFF.h" +#include "llvm/BinaryFormat/ELF.h" +#include "llvm/BinaryFormat/MachO.h" // for CPUType::CPU_T... +#include "llvm/Support/Compiler.h" // for LLVM_FALLTHROUGH #include "llvm/Support/Host.h" -#include "llvm/Support/MachO.h" // for CPUType::CPU_T... #include <memory> // for shared_ptr #include <string> diff --git a/source/Core/CMakeLists.txt b/source/Core/CMakeLists.txt index 7dcec050d8661..806227793f24e 100644 --- a/source/Core/CMakeLists.txt +++ b/source/Core/CMakeLists.txt @@ -67,6 +67,7 @@ add_lldb_library(lldbCore lldbPluginObjectFileJIT LINK_COMPONENTS + BinaryFormat Support Demangle ) diff --git a/source/Core/Section.cpp b/source/Core/Section.cpp index f6428ced0164c..3b76dd361ff3f 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()); |