Revert "DWARF: Simplify SymbolFileDWARF::GetDWARFCompileUnit"

This reverts commit 58afc1bdebf9fa8b178d6c9d89af94c5cc091760.
This commit caused the test suite on macOS to fail many tests. It
appears that setting breakpoints is the issue. One example that fails
is the lit test Breakpoint/case-sensitive.test.

llvm-svn: 362862
This commit is contained in:
Alex Langford 2019-06-08 00:55:03 +00:00
parent cdff380681
commit 5ada887bf2
1 changed files with 9 additions and 1 deletions

View File

@ -608,7 +608,15 @@ SymbolFileDWARF::GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) {
if (!comp_unit)
return nullptr;
return static_cast<DWARFUnit *>(comp_unit->GetUserData());
DWARFDebugInfo *info = DebugInfo();
if (info) {
// The compile unit ID is the index of the DWARF unit.
DWARFUnit *dwarf_cu = info->GetUnitAtIndex(comp_unit->GetID());
if (dwarf_cu && dwarf_cu->GetUserData() == nullptr)
dwarf_cu->SetUserData(comp_unit);
return dwarf_cu;
}
return nullptr;
}
DWARFDebugRangesBase *SymbolFileDWARF::GetDebugRanges() {