================
@@ -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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to