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.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153537 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 9fe9f0f..2d0014a 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -2517,30 +2517,13 @@
SectionList *section_list = objfile->GetSectionList();
if (section_list)
{
+ bool changed = false;
if (argc == 0)
{
if (m_slide_option.GetOptionValue().OptionWasSet())
{
- Module *module = matching_modules.GetModulePointerAtIndex(0);
- if (module)
- {
- ObjectFile *objfile = module->GetObjectFile();
- if (objfile)
- {
- SectionList *section_list = objfile->GetSectionList();
- if (section_list)
- {
- const size_t num_sections = section_list->GetSize();
- const addr_t slide = m_slide_option.GetOptionValue().GetCurrentValue();
- for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx)
- {
- SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx));
- if (section_sp)
- target->GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), section_sp->GetFileAddress() + slide);
- }
- }
- }
- }
+ const addr_t slide = m_slide_option.GetOptionValue().GetCurrentValue();
+ module->SetLoadAddress (*target, slide, changed);
}
else
{
@@ -2572,8 +2555,18 @@
SectionSP section_sp (section_list->FindSectionByName(const_sect_name));
if (section_sp)
{
- target->GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), load_addr);
- result.AppendMessageWithFormat("section '%s' loaded at 0x%llx\n", sect_name, load_addr);
+ if (section_sp->IsThreadSpecific())
+ {
+ result.AppendErrorWithFormat ("thread specific sections are not yet supported (section '%s')\n", sect_name);
+ result.SetStatus (eReturnStatusFailed);
+ break;
+ }
+ else
+ {
+ if (target->GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), load_addr))
+ changed = true;
+ result.AppendMessageWithFormat("section '%s' loaded at 0x%llx\n", sect_name, load_addr);
+ }
}
else
{
@@ -2600,6 +2593,9 @@
}
}
}
+
+ if (changed)
+ target->ModulesDidLoad (matching_modules);
}
else
{