Improve the handling of missing elf symtab and missing symbol sizes

* Generate artificial symbol names from eh_fame during symbol parsing
  so these symbols are already present when we calcualte the size of
  the symbols where 0 is specified.
* Fix symbol size calculation for the last symbol in the file where
  it have to last until the end of the parent section.

Differential revision: http://reviews.llvm.org/D16996

llvm-svn: 260369
This commit is contained in:
Tamas Berghammer
2016-02-10 10:43:34 +00:00
parent 10e9923841
commit ed844cbc0f
10 changed files with 152 additions and 146 deletions

View File

@@ -241,8 +241,7 @@ ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp,
lldb::offset_t file_offset,
lldb::offset_t length,
const lldb::DataBufferSP& data_sp,
lldb::offset_t data_offset
) :
lldb::offset_t data_offset) :
ModuleChild (module_sp),
m_file (), // This file could be different from the original module's file
m_type (eTypeInvalid),
@@ -254,7 +253,8 @@ ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp,
m_process_wp(),
m_memory_addr (LLDB_INVALID_ADDRESS),
m_sections_ap(),
m_symtab_ap ()
m_symtab_ap (),
m_synthetic_symbol_idx (0)
{
if (file_spec_ptr)
m_file = *file_spec_ptr;
@@ -286,7 +286,8 @@ ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp,
m_process_wp (process_sp),
m_memory_addr (header_addr),
m_sections_ap(),
m_symtab_ap ()
m_symtab_ap (),
m_synthetic_symbol_idx (0)
{
if (header_data_sp)
m_data.SetData (header_data_sp, 0, header_data_sp->GetByteSize());
@@ -653,3 +654,13 @@ ObjectFile::GetSymbolTypeFromName (llvm::StringRef name,
}
return symbol_type_hint;
}
ConstString
ObjectFile::GetNextSyntheticSymbolName()
{
StreamString ss;
ConstString file_name = GetModule()->GetFileSpec().GetFilename();
ss.Printf("___lldb_unnamed_symbol%u$$%s", ++m_synthetic_symbol_idx, file_name.GetCString());
return ConstString(ss.GetData());
}