[lldb] [llvm] Add support for using foreign type units in .debug_names. (PR #87740)
Pavel Labath via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 10 00:45:43 PDT 2024
================
@@ -48,20 +60,84 @@ DebugNamesDWARFIndex::GetUnits(const DebugNames &debug_names) {
return result;
}
+std::optional<DWARFTypeUnit *>
+DebugNamesDWARFIndex::IsForeignTypeUnit(const DebugNames::Entry &entry) const {
+ std::optional<uint64_t> type_sig = entry.getForeignTUTypeSignature();
+ if (!type_sig.has_value())
+ return std::nullopt;
+ auto dwp_sp = m_debug_info.GetDwpSymbolFile();
+ if (!dwp_sp) {
+ // No .dwp file, we need to load the .dwo file.
+
+ // Ask the entry for the skeleton compile unit offset and fetch the .dwo
+ // file from it and get the type unit by signature from there. If we find
+ // the type unit in the .dwo file, we don't need to check that the
+ // DW_AT_dwo_name matches because each .dwo file can have its own type unit.
+ std::optional<uint64_t> unit_offset = entry.getForeignTUSkeletonCUOffset();
+ if (!unit_offset)
+ return nullptr; // Return NULL, this is a type unit, but couldn't find it.
+ DWARFUnit *cu =
+ m_debug_info.GetUnitAtOffset(DIERef::Section::DebugInfo, *unit_offset);
+ if (!cu)
+ return nullptr; // Return NULL, this is a type unit, but couldn't find it.
----------------
labath wrote:
I think this part could be moved into the common (dwp and non-dwp) code.
https://github.com/llvm/llvm-project/pull/87740
More information about the llvm-commits
mailing list