[lldb/DWARF] Fix dwo flavour of TestTypeGetModule

SymbolFileDWARF::GetTypes was not handling dwo correctly. The fix is
simple -- adding a GetNonSkeletonUnit call -- but I've snuck in a small
refactor as well.
This commit is contained in:
Pavel Labath 2020-10-30 15:18:11 +01:00
parent bbdbd020d2
commit 8485ee781f
2 changed files with 10 additions and 12 deletions

View File

@ -372,24 +372,23 @@ void SymbolFileDWARF::GetTypes(SymbolContextScope *sc_scope,
TypeSet type_set;
CompileUnit *comp_unit = nullptr;
DWARFUnit *dwarf_cu = nullptr;
if (sc_scope)
comp_unit = sc_scope->CalculateSymbolContextCompileUnit();
if (comp_unit) {
dwarf_cu = GetDWARFCompileUnit(comp_unit);
if (!dwarf_cu)
const auto &get = [&](DWARFUnit *unit) {
if (!unit)
return;
GetTypes(dwarf_cu->DIE(), dwarf_cu->GetOffset(),
dwarf_cu->GetNextUnitOffset(), type_mask, type_set);
unit = &unit->GetNonSkeletonUnit();
GetTypes(unit->DIE(), unit->GetOffset(), unit->GetNextUnitOffset(),
type_mask, type_set);
};
if (comp_unit) {
get(GetDWARFCompileUnit(comp_unit));
} else {
DWARFDebugInfo &info = DebugInfo();
const size_t num_cus = info.GetNumUnits();
for (size_t cu_idx = 0; cu_idx < num_cus; ++cu_idx) {
dwarf_cu = info.GetUnitAtIndex(cu_idx);
if (dwarf_cu)
GetTypes(dwarf_cu->DIE(), 0, UINT32_MAX, type_mask, type_set);
}
for (size_t cu_idx = 0; cu_idx < num_cus; ++cu_idx)
get(info.GetUnitAtIndex(cu_idx));
}
std::set<CompilerType> compiler_type_set;

View File

@ -58,7 +58,6 @@ class TestTypeGetModule(TestBase):
return result
@expectedFailureAll(debug_info=["dwo"])
def test(self):
self.build()
target = lldbutil.run_to_breakpoint_make_target(self)