diff options
author | Greg Clayton <gclayton@apple.com> | 2013-03-04 21:46:16 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-03-04 21:46:16 +0000 |
commit | 9422dd64f870dd3344ca0e5909872765b517fc11 (patch) | |
tree | 24664b0ee18b5f597f8b8a0f7f18bfe14487adee /lldb/source/Symbol/Symtab.cpp | |
parent | 427b404d0a456953d31d4f5d8abc5b3ac112036b (diff) | |
download | bcm5719-llvm-9422dd64f870dd3344ca0e5909872765b517fc11.tar.gz bcm5719-llvm-9422dd64f870dd3344ca0e5909872765b517fc11.zip |
<rdar://problem/13338643>
DWARF with .o files now uses 40-60% less memory!
Big fixes include:
- Change line table internal representation to contain "file addresses". Since each line table is owned by a compile unit that is owned by a module, it makes address translation into lldb_private::Address easy to do when needed.
- Removed linked address members/methods from lldb_private::Section and lldb_private::Address
- lldb_private::LineTable can now relink itself using a FileRangeMap to make it easier to re-link line tables in the future
- Added ObjectFile::ClearSymtab() so that we can get rid of the object file symbol tables after we parse them once since they are not needed and kept memory allocated for no reason
- Moved the m_sections_ap (std::auto_ptr to section list) and m_symtab_ap (std::auto_ptr to the lldb_private::Symtab) out of each of the ObjectFile subclasses and put it into lldb_private::ObjectFile.
- Changed how the debug map is parsed and stored to be able to:
- Lazily parse the debug map for each object file
- not require the address map for a .o file until debug information is linked for a .o file
llvm-svn: 176454
Diffstat (limited to 'lldb/source/Symbol/Symtab.cpp')
-rw-r--r-- | lldb/source/Symbol/Symtab.cpp | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index ee660fb733d..37c204d1890 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -11,6 +11,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/RegularExpression.h" +#include "lldb/Core/Section.h" #include "lldb/Core/Timer.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" @@ -882,13 +883,13 @@ Symtab::CalculateSymbolSize (Symbol *symbol) if (!m_addr_indexes_computed) InitAddressIndexes(); const size_t num_addr_indexes = m_addr_indexes.size(); + const lldb::addr_t symbol_file_addr = symbol->GetAddress().GetFileAddress(); SymbolSearchInfo info = FindIndexPtrForSymbolContainingAddress (this, - symbol->GetAddress().GetFileAddress(), + symbol_file_addr, &m_addr_indexes.front(), num_addr_indexes); if (info.match_index_ptr != NULL) { - const lldb::addr_t curr_file_addr = symbol->GetAddress().GetFileAddress(); // We can figure out the address range of all symbols except the // last one by taking the delta between the current symbol and // the next symbol @@ -899,15 +900,32 @@ Symtab::CalculateSymbolSize (Symbol *symbol) { Symbol *next_symbol = SymbolAtIndex(m_addr_indexes[addr_index]); if (next_symbol == NULL) - break; - - const lldb::addr_t next_file_addr = next_symbol->GetAddress().GetFileAddress(); - if (next_file_addr > curr_file_addr) { - byte_size = next_file_addr - curr_file_addr; - symbol->SetByteSize(byte_size); - symbol->SetSizeIsSynthesized(true); - break; + // No next symbol take the size to be the remaining bytes in the section + // in which the symbol resides + SectionSP section_sp (m_objfile->GetSectionList()->FindSectionContainingFileAddress (symbol_file_addr)); + if (section_sp) + { + const lldb::addr_t end_section_file_addr = section_sp->GetFileAddress() + section_sp->GetByteSize(); + if (end_section_file_addr > symbol_file_addr) + { + byte_size = end_section_file_addr - symbol_file_addr; + symbol->SetByteSize(byte_size); + symbol->SetSizeIsSynthesized(true); + break; + } + } + } + else + { + const lldb::addr_t next_file_addr = next_symbol->GetAddress().GetFileAddress(); + if (next_file_addr > symbol_file_addr) + { + byte_size = next_file_addr - symbol_file_addr; + symbol->SetByteSize(byte_size); + symbol->SetSizeIsSynthesized(true); + break; + } } } } |