diff options
author | Michael Sartain <mikesart@valvesoftware.com> | 2013-07-01 19:45:50 +0000 |
---|---|---|
committer | Michael Sartain <mikesart@valvesoftware.com> | 2013-07-01 19:45:50 +0000 |
commit | a7499c98301e847d2e525921801e1edcc44e34da (patch) | |
tree | 4b78835f6badd7ce118ed5175279f4efc26f0c80 /lldb/source/Core/Section.cpp | |
parent | 82bedb1f3ba396b32b0f2275e5e1003e4b143398 (diff) | |
download | bcm5719-llvm-a7499c98301e847d2e525921801e1edcc44e34da.tar.gz bcm5719-llvm-a7499c98301e847d2e525921801e1edcc44e34da.zip |
Split symbol support for ELF and Linux.
llvm-svn: 185366
Diffstat (limited to 'lldb/source/Core/Section.cpp')
-rw-r--r-- | lldb/source/Core/Section.cpp | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index 203a6daf5cc..cb565f07a27 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -16,6 +16,7 @@ using namespace lldb; using namespace lldb_private; Section::Section (const ModuleSP &module_sp, + ObjectFile *obj_file, user_id_t sect_id, const ConstString &name, SectionType sect_type, @@ -27,6 +28,7 @@ Section::Section (const ModuleSP &module_sp, ModuleChild (module_sp), UserID (sect_id), Flags (flags), + m_obj_file (obj_file), m_type (sect_type), m_parent_wp (), m_name (name), @@ -45,6 +47,7 @@ Section::Section (const ModuleSP &module_sp, Section::Section (const lldb::SectionSP &parent_section_sp, const ModuleSP &module_sp, + ObjectFile *obj_file, user_id_t sect_id, const ConstString &name, SectionType sect_type, @@ -56,6 +59,7 @@ Section::Section (const lldb::SectionSP &parent_section_sp, ModuleChild (module_sp), UserID (sect_id), Flags (flags), + m_obj_file (obj_file), m_type (sect_type), m_parent_wp (), m_name (name), @@ -242,13 +246,16 @@ Section::DumpName (Stream *s) const else { // The top most section prints the module basename + const char * name = NULL; ModuleSP module_sp (GetModule()); - if (module_sp) - { - const char *module_basename = module_sp->GetFileSpec().GetFilename().AsCString(); - if (module_basename && module_basename[0]) - s->Printf("%s.", module_basename); - } + const FileSpec &file_spec = m_obj_file->GetFileSpec(); + + if (m_obj_file) + name = file_spec.GetFilename().AsCString(); + if ((!name || !name[0]) && module_sp) + name = module_sp->GetFileSpec().GetFilename().AsCString(); + if (name && name[0]) + s->Printf("%s.", name); } m_name.Dump(s); } @@ -285,6 +292,8 @@ Section::Slide (addr_t slide_amount, bool slide_children) #pragma mark SectionList SectionList::SectionList () : + m_changed(false), + m_revision_id(0), m_sections() { } @@ -294,15 +303,41 @@ SectionList::~SectionList () { } +bool +SectionList::Copy (SectionList *dest_section_list) +{ + if (dest_section_list) + { + dest_section_list->m_sections = m_sections; + dest_section_list->m_changed = true; + return true; + } + return false; +} + size_t SectionList::AddSection (const lldb::SectionSP& section_sp) { + m_changed = true; assert (section_sp.get()); size_t section_index = m_sections.size(); m_sections.push_back(section_sp); return section_index; } +// Warning, this can be slow as it's removing items from a std::vector. +bool +SectionList::DeleteSection (size_t idx) +{ + if (idx < m_sections.size()) + { + m_changed = true; + m_sections.erase (m_sections.begin() + idx); + return true; + } + return false; +} + size_t SectionList::FindSectionIndex (const Section* sect) { @@ -325,11 +360,13 @@ SectionList::AddUniqueSection (const lldb::SectionSP& sect_sp) { size_t sect_idx = FindSectionIndex (sect_sp.get()); if (sect_idx == UINT32_MAX) + { + m_changed = true; sect_idx = AddSection (sect_sp); + } return sect_idx; } - bool SectionList::ReplaceSection (user_id_t sect_id, const lldb::SectionSP& sect_sp, uint32_t depth) { @@ -338,6 +375,7 @@ SectionList::ReplaceSection (user_id_t sect_id, const lldb::SectionSP& sect_sp, { if ((*sect_iter)->GetID() == sect_id) { + m_changed = true; *sect_iter = sect_sp; return true; } @@ -350,7 +388,6 @@ SectionList::ReplaceSection (user_id_t sect_id, const lldb::SectionSP& sect_sp, return false; } - size_t SectionList::GetNumSections (uint32_t depth) const { @@ -527,5 +564,10 @@ SectionList::Finalize () sect->GetChildren().Finalize(); } -} + if (m_changed) + { + m_revision_id++; + m_changed = false; + } +} |