Fixed an issue that would cause an assertion to fire when an inlined function was found during a regex function find call.

llvm-svn: 120814
This commit is contained in:
Greg Clayton 2010-12-03 17:49:14 +00:00
parent eb5596b4af
commit ab843393f2
1 changed files with 41 additions and 9 deletions

View File

@ -2025,20 +2025,52 @@ SymbolFileDWARF::FindFunctions
curr_cu->ExtractDIEsIfNeeded (false);
die = curr_cu->GetDIEAtIndexUnchecked(die_info_array[i].die_idx);
const DWARFDebugInfoEntry* inlined_die = NULL;
if (die->Tag() == DW_TAG_inlined_subroutine)
{
inlined_die = die;
while ((die = die->GetParent()) != NULL)
{
if (die->Tag() == DW_TAG_subprogram)
break;
}
}
assert (die->Tag() == DW_TAG_subprogram);
if (GetFunction (curr_cu, die, sc))
{
// We found the function, so we should find the line table
// and line table entry as well
LineTable *line_table = sc.comp_unit->GetLineTable();
if (line_table == NULL)
Address addr;
// Parse all blocks if needed
if (inlined_die)
{
if (ParseCompileUnitLineTable(sc))
line_table = sc.comp_unit->GetLineTable();
sc.block = sc.function->GetBlock (true).FindBlockByID (inlined_die->GetOffset());
assert (sc.block != NULL);
if (sc.block->GetStartAddress (addr) == false)
addr.Clear();
}
else
{
sc.block = NULL;
addr = sc.function->GetAddressRange().GetBaseAddress();
}
if (line_table != NULL)
line_table->FindLineEntryByAddress (sc.function->GetAddressRange().GetBaseAddress(), sc.line_entry);
sc_list.Append(sc);
if (addr.IsValid())
{
// We found the function, so we should find the line table
// and line table entry as well
LineTable *line_table = sc.comp_unit->GetLineTable();
if (line_table == NULL)
{
if (ParseCompileUnitLineTable(sc))
line_table = sc.comp_unit->GetLineTable();
}
if (line_table != NULL)
line_table->FindLineEntryByAddress (addr, sc.line_entry);
sc_list.Append(sc);
}
}
}
}