Cleanup on the unified section list changes. Main changes are:

- ObjectFile::GetSymtab() and ObjectFile::ClearSymtab() no longer takes any flags
- Module coordinates with the object files and contain a unified section list so that object file and symbol file can share sections when they need to, yet contain their own sections.

Other cleanups:
- Fixed Symbol::GetByteSize() to not have the symbol table compute the byte sizes on the fly
- Modified the ObjectFileMachO class to compute symbol sizes all at once efficiently
- Modified the Symtab class to store a file address lookup table for more efficient lookups
- Removed Section::Finalize() and SectionList::Finalize() as they did nothing
- Improved performance of the detection of symbol files that have debug maps by excluding stripped files and core files, debug files, object files and stubs
- Added the ability to tell if an ObjectFile has been stripped with ObjectFile::IsStripped() (used this for the above performance improvement)

llvm-svn: 185990
This commit is contained in:
Greg Clayton
2013-07-10 01:23:25 +00:00
parent 8978a9dd0a
commit 3046e66830
30 changed files with 988 additions and 1073 deletions

View File

@@ -511,7 +511,7 @@ ObjectFilePECOFF::GetSectionName(std::string& sect_name, const section_header_t&
// GetNListSymtab
//----------------------------------------------------------------------
Symtab *
ObjectFilePECOFF::GetSymtab(uint32_t flags)
ObjectFilePECOFF::GetSymtab()
{
ModuleSP module_sp(GetModule());
if (module_sp)
@@ -597,16 +597,26 @@ ObjectFilePECOFF::GetSymtab(uint32_t flags)
}
SectionList *
ObjectFilePECOFF::GetSectionList()
bool
ObjectFilePECOFF::IsStripped ()
{
ModuleSP module_sp(GetModule());
if (module_sp)
// TODO: determine this for COFF
return false;
}
void
ObjectFilePECOFF::CreateSections (SectionList &unified_section_list)
{
if (!m_sections_ap.get())
{
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
if (m_sections_ap.get() == NULL)
m_sections_ap.reset(new SectionList());
ModuleSP module_sp(GetModule());
if (module_sp)
{
m_sections_ap.reset(new SectionList());
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
const uint32_t nsects = m_sect_headers.size();
ModuleSP module_sp (GetModule());
for (uint32_t idx = 0; idx<nsects; ++idx)
@@ -710,13 +720,11 @@ ObjectFilePECOFF::GetSectionList()
//section_sp->SetIsEncrypted (segment_is_encrypted);
m_sections_ap->AddSection(section_sp);
unified_section_list.AddSection(section_sp);
m_sections_ap->AddSection (section_sp);
}
m_sections_ap->Finalize(); // Now that we're done adding sections, finalize to build fast-lookup caches
}
}
return m_sections_ap.get();
}
bool
@@ -754,8 +762,9 @@ ObjectFilePECOFF::Dump(Stream *s)
*s << ", file = '" << m_file << "', arch = " << header_arch.GetArchitectureName() << "\n";
if (m_sections_ap.get())
m_sections_ap->Dump(s, NULL, true, UINT32_MAX);
SectionList *sections = GetSectionList();
if (sections)
sections->Dump(s, NULL, true, UINT32_MAX);
if (m_symtab_ap.get())
m_symtab_ap->Dump(s, NULL, eSortOrderNone);