diff options
| author | Greg Clayton <gclayton@apple.com> | 2012-03-27 21:10:07 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2012-03-27 21:10:07 +0000 |
| commit | 741f3f9a5577ae5e8c2f594e1d5df70ac78092ce (patch) | |
| tree | e0809897ef60ab37589c72526b9b6d2e6d7bc963 /lldb/source/API | |
| parent | 52656d1047f53dd7018922793e132da87f7b52ff (diff) | |
| download | bcm5719-llvm-741f3f9a5577ae5e8c2f594e1d5df70ac78092ce.tar.gz bcm5719-llvm-741f3f9a5577ae5e8c2f594e1d5df70ac78092ce.zip | |
lldb_private::Section objects have a boolean flag that can be set that
indicates that the section is thread specific. Any functions the load a module
given a slide, will currently ignore any sections that are thread specific.
lldb_private::Section now has:
bool
Section::IsThreadSpecific () const
{
return m_thread_specific;
}
void
Section::SetIsThreadSpecific (bool b)
{
m_thread_specific = b;
}
The ELF plug-in has been modified to set this for the ".tdata" and the ".tbss"
sections.
Eventually we need to have each lldb_private::Thread subclass be able to
resolve a thread specific section, but for now they will just not resolve. The
code for that should be trivual to add, but the address resolving functions
will need to be changed to take a "ExecutionContext" object instead of just
a target so that thread specific sections can be resolved.
llvm-svn: 153537
Diffstat (limited to 'lldb/source/API')
| -rw-r--r-- | lldb/source/API/SBTarget.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 0adbb0af490..97b4e475f26 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -2086,12 +2086,23 @@ SBTarget::SetSectionLoadAddress (lldb::SBSection section, } else { - target_sp->GetSectionLoadList().SetSectionLoadAddress (section.GetSP().get(), section_base_addr); + SectionSP section_sp (section.GetSP()); + if (section_sp) + { + if (section_sp->IsThreadSpecific()) + { + sb_error.SetErrorString ("thread specific sections are not yet supported"); + } + else + { + target_sp->GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), section_base_addr); + } + } } } else { - sb_error.SetErrorStringWithFormat ("invalid target"); + sb_error.SetErrorString ("invalid target"); } return sb_error; } @@ -2132,31 +2143,18 @@ SBTarget::SetModuleLoadAddress (lldb::SBModule module, int64_t slide_offset) ModuleSP module_sp (module.GetSP()); if (module_sp) { - ObjectFile *objfile = module_sp->GetObjectFile(); - if (objfile) + bool changed = false; + if (module_sp->SetLoadAddress (*target_sp, slide_offset, changed)) { - SectionList *section_list = objfile->GetSectionList(); - if (section_list) - { - const size_t num_sections = section_list->GetSize(); - for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx) - { - SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx)); - if (section_sp) - target_sp->GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), section_sp->GetFileAddress() + slide_offset); - } - } - else + // The load was successful, make sure that at least some sections + // changed before we notify that our module was loaded. + if (changed) { - module_sp->GetFileSpec().GetPath (path, sizeof(path)); - sb_error.SetErrorStringWithFormat ("no sections in object file '%s'", path); + ModuleList module_list; + module_list.Append(module_sp); + target_sp->ModulesDidLoad (module_list); } } - else - { - module_sp->GetFileSpec().GetPath (path, sizeof(path)); - sb_error.SetErrorStringWithFormat ("no object file for module '%s'", path); - } } else { |

