Fixed in issue with ObjectFileMachO where it would add empty sections to the section list that was used to try and cap symbols to the max address of the section in which it is contained. The empty sections would make cap the symbols and make their sizes zero. Also fixed a few other things that could cause problems in the SymbolFileDWARFDebugMap when zero sized symbols were found and used to make OSO range map entries.

<rdar://problem/25886773>

llvm-svn: 267237
This commit is contained in:
Greg Clayton 2016-04-22 22:35:08 +00:00
parent 79a933a686
commit f443135b8c
3 changed files with 22 additions and 8 deletions

View File

@ -123,8 +123,9 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa
// Add the inverse OSO file address to debug map entry mapping
exe_symfile->AddOSOFileRange (this,
exe_symbol->GetAddressRef().GetFileAddress(),
exe_symbol->GetByteSize(),
oso_fun_symbol->GetAddressRef().GetFileAddress(),
std::min<addr_t>(exe_symbol->GetByteSize(), oso_fun_symbol->GetByteSize()));
oso_fun_symbol->GetByteSize());
}
}
@ -157,8 +158,9 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa
// Add the inverse OSO file address to debug map entry mapping
exe_symfile->AddOSOFileRange (this,
exe_symbol->GetAddressRef().GetFileAddress(),
exe_symbol->GetByteSize(),
oso_gsym_symbol->GetAddressRef().GetFileAddress(),
std::min<addr_t>(exe_symbol->GetByteSize(), oso_gsym_symbol->GetByteSize()));
oso_gsym_symbol->GetByteSize());
}
}
break;
@ -1456,6 +1458,7 @@ SymbolFileDWARFDebugMap::ParseDeclsForContext (lldb_private::CompilerDeclContext
bool
SymbolFileDWARFDebugMap::AddOSOFileRange (CompileUnitInfo *cu_info,
lldb::addr_t exe_file_addr,
lldb::addr_t exe_byte_size,
lldb::addr_t oso_file_addr,
lldb::addr_t oso_byte_size)
{
@ -1464,7 +1467,14 @@ SymbolFileDWARFDebugMap::AddOSOFileRange (CompileUnitInfo *cu_info,
{
DebugMap::Entry *debug_map_entry = m_debug_map.FindEntryThatContains(exe_file_addr);
debug_map_entry->data.SetOSOFileAddress(oso_file_addr);
cu_info->file_range_map.Append(FileRangeMap::Entry(oso_file_addr, oso_byte_size, exe_file_addr));
addr_t range_size = std::min<addr_t>(exe_byte_size, oso_byte_size);
if (range_size == 0)
{
range_size = std::max<addr_t>(exe_byte_size, oso_byte_size);
if (range_size == 0)
range_size = 1;
}
cu_info->file_range_map.Append(FileRangeMap::Entry(oso_file_addr, range_size, exe_file_addr));
return true;
}
return false;

View File

@ -349,6 +349,7 @@ protected:
bool
AddOSOFileRange (CompileUnitInfo *cu_info,
lldb::addr_t exe_file_addr,
lldb::addr_t exe_byte_size,
lldb::addr_t oso_file_addr,
lldb::addr_t oso_byte_size);

View File

@ -915,12 +915,15 @@ AddSectionsToRangeMap (SectionList *sectlist, RangeVector<addr_t, addr_t> &secti
}
else
{
addr_t base_addr = sect_sp->GetFileAddress();
size_t size = sect_sp->GetByteSize();
RangeVector<addr_t, addr_t>::Entry entry;
entry.SetRangeBase (base_addr);
entry.SetByteSize (size);
section_ranges.Append (entry);
if (size > 0)
{
addr_t base_addr = sect_sp->GetFileAddress();
RangeVector<addr_t, addr_t>::Entry entry;
entry.SetRangeBase (base_addr);
entry.SetByteSize (size);
section_ranges.Append (entry);
}
}
}
}