Fixed an issue when debugging with DWARF in the .o files where

if two functions had the same demangled names (constructors where
we have the in charge and not in charge version) we could end up
mixing the two up when making the function in the DWARF. This was
because we need to lookup the symbol by name and we need to use the
mangled name if there is one. This ensures we get the correct address
and that we resolve the linked addresses correctly for DWARf with debug
map.

llvm-svn: 121116
This commit is contained in:
Greg Clayton 2010-12-07 07:37:38 +00:00
parent 75dbe3c799
commit 65e364e5da
3 changed files with 6 additions and 9 deletions

View File

@ -2459,7 +2459,6 @@
isa = PBXProject;
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,

View File

@ -272,7 +272,7 @@ Section::Dump (Stream *s, Target *target) const
addr = m_linked_section->GetFileAddress() + m_linked_offset;
}
int indent = (sizeof(void*) + 1 + sizeof(user_id_t) + 1) * 2 + 3 + s->GetIndentLevel();
int indent = 26 + s->GetIndentLevel();
s->Printf("%*.*s", indent, indent, "");
VMRange linked_range(addr, addr + m_byte_size);
linked_range.Dump (s, 0);
@ -289,9 +289,7 @@ Section::Dump (Stream *s, Target *target) const
void
Section::DumpName (Stream *s) const
{
if (m_linked_section)
return m_linked_section->DumpName(s);
else if (m_parent == NULL)
if (m_parent == NULL)
{
// The top most section prints the module basename
const char *module_basename = m_module->GetFileSpec().GetFilename().AsCString();

View File

@ -282,7 +282,7 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit
// correctly to the new addresses in the main executable.
// First we find the original symbol in the .o file's symbol table
Symbol *oso_fun_symbol = oso_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(), eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny);
Symbol *oso_fun_symbol = oso_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny);
if (oso_fun_symbol)
{
// If we found the symbol, then we
@ -301,7 +301,7 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit
SectionSP oso_fun_section_sp (new Section (const_cast<Section *>(oso_fun_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection()),
oso_module, // Module (the .o file)
sect_id++, // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs
exe_symbol->GetMangled().GetName(), // Name the section the same as the symbol for which is was generated!
exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated!
eSectionTypeDebug,
oso_fun_symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset(), // File VM address offset in the current section
exe_symbol->GetByteSize(), // File size (we need the size from the executable)
@ -333,7 +333,7 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit
#if 0
// First we find the non-stab entry that corresponds to the N_GSYM in the executable
Symbol *exe_gsym_symbol = exe_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(), eSymbolTypeData, Symtab::eDebugNo, Symtab::eVisibilityAny);
Symbol *exe_gsym_symbol = exe_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), eSymbolTypeData, Symtab::eDebugNo, Symtab::eVisibilityAny);
#else
// The mach-o object file parser already matches up the N_GSYM with with the non-stab
// entry, so we shouldn't have to do that. If this ever changes, enable the code above
@ -352,7 +352,7 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit
SectionSP oso_gsym_section_sp (new Section (const_cast<Section *>(oso_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection()),
oso_module, // Module (the .o file)
sect_id++, // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs
exe_symbol->GetMangled().GetName(), // Name the section the same as the symbol for which is was generated!
exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated!
eSectionTypeDebug,
oso_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset(), // File VM address offset in the current section
1, // We don't know the size of the global, just do the main address for now.