diff options
author | Ed Maste <emaste@FreeBSD.org> | 2014-02-18 16:23:10 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2014-02-18 16:23:10 +0000 |
commit | 866dcdacfe59f5f448e008fe2c4cb9dfcf72b2ec (patch) | |
tree | 95cb16075f0af1b3a05b9b84eb18dda8e6c903e9 /source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | |
parent | de889deb2c386f2a7831befaf226e5c86685fa53 (diff) |
Notes
Diffstat (limited to 'source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r-- | source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 7bdacfe14cdea..02db05b3c6b2b 100644 --- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -24,6 +24,7 @@ #include "lldb/Core/Stream.h" #include "lldb/Symbol/DWARFCallFrameInfo.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Host/Host.h" @@ -462,6 +463,49 @@ ObjectFileELF::IsExecutable() const return m_header.e_entry != 0; } +bool +ObjectFileELF::SetLoadAddress (Target &target, + lldb::addr_t value, + bool value_is_offset) +{ + bool changed = false; + ModuleSP module_sp = GetModule(); + if (module_sp) + { + size_t num_loaded_sections = 0; + SectionList *section_list = GetSectionList (); + if (section_list) + { + if (value_is_offset) + { + const size_t num_sections = section_list->GetSize(); + size_t sect_idx = 0; + + for (sect_idx = 0; sect_idx < num_sections; ++sect_idx) + { + // Iterate through the object file sections to find all + // of the sections that have SHF_ALLOC in their flag bits. + SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx)); + // if (section_sp && !section_sp->IsThreadSpecific()) + if (section_sp && section_sp->Test(SHF_ALLOC)) + { + if (target.GetSectionLoadList().SetSectionLoadAddress (section_sp, section_sp->GetFileAddress() + value)) + ++num_loaded_sections; + } + } + changed = num_loaded_sections > 0; + return num_loaded_sections > 0; + } + else + { + // Not sure how to slide an ELF file given the base address + // of the ELF file in memory + } + } + } + return changed; +} + ByteOrder ObjectFileELF::GetByteOrder() const { |