summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2014-02-07 22:54:47 +0000
committerGreg Clayton <gclayton@apple.com>2014-02-07 22:54:47 +0000
commit751caf65c26cf20b805e73ef650d688cfe7f7bc6 (patch)
treecfe358359bb94866b91dd339f4549370621215d6 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
parentc7fb225cdc4662535340acb5ee0749a5c6d3c7d3 (diff)
downloadbcm5719-llvm-751caf65c26cf20b805e73ef650d688cfe7f7bc6.tar.gz
bcm5719-llvm-751caf65c26cf20b805e73ef650d688cfe7f7bc6.zip
Modified ObjectFile::SetLoadAddress() to now be:
ObjectFile::SetLoadAddress (Target &target, lldb::addr_t value, bool value_is_offset); Now "value" is a slide if "value_is_offset" is true, and "value" is an image base address otherwise. All previous usage of this API was using slides. Updated the ObjectFileELF and ObjectFileMachO SetLoadAddress methods to do the right thing. Also updated the ObjectFileMachO::SetLoadAddress() function to not load __LINKEDIT when it isn't needed and to only load sections that belong to the executable object file. llvm-svn: 201003
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 2f3cd8b78cf..02db05b3c6b 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -464,7 +464,9 @@ ObjectFileELF::IsExecutable() const
}
bool
-ObjectFileELF::SetLoadAddress(Target &target, addr_t base_addr)
+ObjectFileELF::SetLoadAddress (Target &target,
+ lldb::addr_t value,
+ bool value_is_offset)
{
bool changed = false;
ModuleSP module_sp = GetModule();
@@ -474,23 +476,32 @@ ObjectFileELF::SetLoadAddress(Target &target, addr_t base_addr)
SectionList *section_list = GetSectionList ();
if (section_list)
{
- const size_t num_sections = section_list->GetSize();
- size_t sect_idx = 0;
- for (sect_idx = 0; sect_idx < num_sections; ++sect_idx)
+ if (value_is_offset)
{
- // 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))
+ const size_t num_sections = section_list->GetSize();
+ size_t sect_idx = 0;
+
+ for (sect_idx = 0; sect_idx < num_sections; ++sect_idx)
{
- if (target.GetSectionLoadList().SetSectionLoadAddress (section_sp, section_sp->GetFileAddress() + base_addr))
- ++num_loaded_sections;
+ // 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
}
}
- changed = num_loaded_sections > 0;
- return num_loaded_sections > 0;
}
return changed;
}
OpenPOWER on IntegriCloud