Skip to content

Commit e0fd069

Browse files
committed
Respond to user comments.
1 parent 46cb76b commit e0fd069

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

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

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,23 @@ DebugNamesDWARFIndex::IsForeignTypeUnit(const DebugNames::Entry &entry) const {
6565
std::optional<uint64_t> type_sig = entry.getForeignTUTypeSignature();
6666
if (!type_sig.has_value())
6767
return std::nullopt;
68+
69+
// Ask the entry for the skeleton compile unit offset and fetch the .dwo
70+
// file from it and get the type unit by signature from there. If we find
71+
// the type unit in the .dwo file, we don't need to check that the
72+
// DW_AT_dwo_name matches because each .dwo file can have its own type unit.
73+
std::optional<uint64_t> cu_offset = entry.getForeignTUSkeletonCUOffset();
74+
if (!cu_offset)
75+
return nullptr; // Return NULL, this is a type unit, but couldn't find it.
76+
77+
DWARFUnit *cu =
78+
m_debug_info.GetUnitAtOffset(DIERef::Section::DebugInfo, *cu_offset);
79+
if (!cu)
80+
return nullptr; // Return NULL, this is a type unit, but couldn't find it.
81+
6882
auto dwp_sp = m_debug_info.GetDwpSymbolFile();
6983
if (!dwp_sp) {
7084
// No .dwp file, we need to load the .dwo file.
71-
72-
// Ask the entry for the skeleton compile unit offset and fetch the .dwo
73-
// file from it and get the type unit by signature from there. If we find
74-
// the type unit in the .dwo file, we don't need to check that the
75-
// DW_AT_dwo_name matches because each .dwo file can have its own type unit.
76-
std::optional<uint64_t> unit_offset = entry.getForeignTUSkeletonCUOffset();
77-
if (!unit_offset)
78-
return nullptr; // Return NULL, this is a type unit, but couldn't find it.
79-
DWARFUnit *cu =
80-
m_debug_info.GetUnitAtOffset(DIERef::Section::DebugInfo, *unit_offset);
81-
if (!cu)
82-
return nullptr; // Return NULL, this is a type unit, but couldn't find it.
8385
DWARFUnit &dwo_cu = cu->GetNonSkeletonUnit();
8486
// We don't need the check if the type unit matches the .dwo file if we have
8587
// a .dwo file (not a .dwp), so we can just return the value here.
@@ -104,20 +106,14 @@ DebugNamesDWARFIndex::IsForeignTypeUnit(const DebugNames::Entry &entry) const {
104106
if (!foreign_tu)
105107
return nullptr; // Return NULL, this is a type unit, but couldn't find it.
106108

107-
std::optional<uint64_t> cu_offset = entry.getForeignTUSkeletonCUOffset();
108-
if (cu_offset) {
109-
DWARFUnit *cu = m_debug_info.GetUnitAtOffset(DIERef::DebugInfo, *cu_offset);
110-
if (cu) {
111-
DWARFBaseDIE cu_die = cu->GetUnitDIEOnly();
112-
DWARFBaseDIE tu_die = foreign_tu->GetUnitDIEOnly();
113-
llvm::StringRef cu_dwo_name =
114-
cu_die.GetAttributeValueAsString(DW_AT_dwo_name, nullptr);
115-
llvm::StringRef tu_dwo_name =
116-
tu_die.GetAttributeValueAsString(DW_AT_dwo_name, nullptr);
117-
if (cu_dwo_name == tu_dwo_name)
118-
return foreign_tu; // We found a match!
119-
}
120-
}
109+
DWARFBaseDIE cu_die = cu->GetUnitDIEOnly();
110+
DWARFBaseDIE tu_die = foreign_tu->GetUnitDIEOnly();
111+
llvm::StringRef cu_dwo_name =
112+
cu_die.GetAttributeValueAsString(DW_AT_dwo_name, nullptr);
113+
llvm::StringRef tu_dwo_name =
114+
tu_die.GetAttributeValueAsString(DW_AT_dwo_name, nullptr);
115+
if (cu_dwo_name == tu_dwo_name)
116+
return foreign_tu; // We found a match!
121117
return nullptr; // Return NULL, this is a type unit, but couldn't find it.
122118
}
123119

0 commit comments

Comments
 (0)