Skip to content

Commit 8485ee7

Browse files
committed
[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.
1 parent bbdbd02 commit 8485ee7

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

+10-11
Original file line numberDiff line numberDiff line change
@@ -372,24 +372,23 @@ void SymbolFileDWARF::GetTypes(SymbolContextScope *sc_scope,
372372
TypeSet type_set;
373373

374374
CompileUnit *comp_unit = nullptr;
375-
DWARFUnit *dwarf_cu = nullptr;
376375
if (sc_scope)
377376
comp_unit = sc_scope->CalculateSymbolContextCompileUnit();
378377

379-
if (comp_unit) {
380-
dwarf_cu = GetDWARFCompileUnit(comp_unit);
381-
if (!dwarf_cu)
378+
const auto &get = [&](DWARFUnit *unit) {
379+
if (!unit)
382380
return;
383-
GetTypes(dwarf_cu->DIE(), dwarf_cu->GetOffset(),
384-
dwarf_cu->GetNextUnitOffset(), type_mask, type_set);
381+
unit = &unit->GetNonSkeletonUnit();
382+
GetTypes(unit->DIE(), unit->GetOffset(), unit->GetNextUnitOffset(),
383+
type_mask, type_set);
384+
};
385+
if (comp_unit) {
386+
get(GetDWARFCompileUnit(comp_unit));
385387
} else {
386388
DWARFDebugInfo &info = DebugInfo();
387389
const size_t num_cus = info.GetNumUnits();
388-
for (size_t cu_idx = 0; cu_idx < num_cus; ++cu_idx) {
389-
dwarf_cu = info.GetUnitAtIndex(cu_idx);
390-
if (dwarf_cu)
391-
GetTypes(dwarf_cu->DIE(), 0, UINT32_MAX, type_mask, type_set);
392-
}
390+
for (size_t cu_idx = 0; cu_idx < num_cus; ++cu_idx)
391+
get(info.GetUnitAtIndex(cu_idx));
393392
}
394393

395394
std::set<CompilerType> compiler_type_set;

lldb/test/API/functionalities/type_get_module/TestTypeGetModule.py

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def find_type(self, type_list, name):
5858

5959
return result
6060

61-
@expectedFailureAll(debug_info=["dwo"])
6261
def test(self):
6362
self.build()
6463
target = lldbutil.run_to_breakpoint_make_target(self)

0 commit comments

Comments
 (0)