Skip to content

Commit

Permalink
Don't crash if we have a DIE that has a DW_AT_ranges attribute and ye…
Browse files Browse the repository at this point in the history
…t the SymbolFileDWARF doesn't have a DebugRanges. If this happens print a nice error message to prompt the user to file a bug and attach the offending DWARF file so we can get the correct compiler fixed.

<rdar://problem/24458016>

llvm-svn: 260626
  • Loading branch information
Greg Clayton committed Feb 12, 2016
1 parent b80a581 commit 9ddad93
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
Expand Up @@ -482,11 +482,19 @@ DWARFDebugInfoEntry::GetDIENamesAndRanges
case DW_AT_ranges:
{
const DWARFDebugRanges* debug_ranges = dwarf2Data->DebugRanges();
debug_ranges->FindRanges(form_value.Unsigned(), ranges);
// All DW_AT_ranges are relative to the base address of the
// compile unit. We add the compile unit base address to make
// sure all the addresses are properly fixed up.
ranges.Slide(cu->GetBaseAddress());
if (debug_ranges)
{
debug_ranges->FindRanges(form_value.Unsigned(), ranges);
// All DW_AT_ranges are relative to the base address of the
// compile unit. We add the compile unit base address to make
// sure all the addresses are properly fixed up.
ranges.Slide(cu->GetBaseAddress());
}
else
{
cu->GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError ("{0x%8.8x}: DIE has DW_AT_ranges(0x%" PRIx64 ") attribute yet DWARF has no .debug_ranges, please file a bug and attach the file at the start of this error message",
m_offset, form_value.Unsigned());
}
}
break;

Expand Down

0 comments on commit 9ddad93

Please sign in to comment.