summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
authorSteve Pucci <spucci@google.com>2014-02-06 19:02:19 +0000
committerSteve Pucci <spucci@google.com>2014-02-06 19:02:19 +0000
commit9e02dacddf24c649b256d476f0121c1ce52be8ff (patch)
treea47093c6a69eb4c831aaa81d6d37cabec8443cf5 /lldb/source/Core/Module.cpp
parent9b9a8d330c142f1c445446ab7053a5bb1bf581c1 (diff)
downloadbcm5719-llvm-9e02dacddf24c649b256d476f0121c1ce52be8ff.tar.gz
bcm5719-llvm-9e02dacddf24c649b256d476f0121c1ce52be8ff.zip
Factor some methods that were in DynamicLoaderPOSIXDYLD.
Move some code that was in DynamicLoaderPOSIXDLYD into the base class DynamicLoader. In the case of UpdateLoadedSections(), the test to see whether a file is loadable (its address is zero) is not generally applicable so that test is changed to a more universally applicable check for the SHF_ALLOC flag on the section. Also make it explicit that the reading of the module_id in DynamicLoaderPOSIXDYLD::GetThreadLocalData() is using a hardcoded size (of module_id) of 4, which might not be appropriate on big-endian 64-bit systems, leaving a FIXME comment in place. llvm-svn: 200939
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r--lldb/source/Core/Module.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 3815a2b08e6..64a16798608 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1502,28 +1502,12 @@ Module::SetArchitecture (const ArchSpec &new_arch)
bool
Module::SetLoadAddress (Target &target, lldb::addr_t offset, bool &changed)
{
- size_t num_loaded_sections = 0;
- SectionList *section_list = GetSectionList ();
- if (section_list)
+ ObjectFile *object_file = GetObjectFile();
+ if (object_file)
{
- 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 the
- // first section that starts of file offset zero and that
- // has bytes in the file...
- SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx));
- // Only load non-thread specific sections when given a slide
- if (section_sp && !section_sp->IsThreadSpecific())
- {
- if (target.GetSectionLoadList().SetSectionLoadAddress (section_sp, section_sp->GetFileAddress() + offset))
- ++num_loaded_sections;
- }
- }
+ return object_file->SetLoadAddress(target, offset);
}
- changed = num_loaded_sections > 0;
- return num_loaded_sections > 0;
+ return false;
}
OpenPOWER on IntegriCloud