================
@@ -657,6 +657,42 @@ std::optional<uint64_t>
DWARFDebugNames::Entry::getLocalTUOffset() const {
return NameIdx->getLocalTUOffset(*Index);
}
+std::optional<uint64_t>
+DWARFDebugNames::Entry::getForeignTUTypeSignature() const {
+ std::optional<uint64_t> Index = getLocalTUIndex();
+ const uint32_t NumLocalTUs = NameIdx->getLocalTUCount();
+ if (!Index || *Index < NumLocalTUs)
+ return std::nullopt; // Invalid TU index or TU index is for a local TU
+ // The foreign TU index is the TU index minus the number of local TUs.
+ const uint64_t ForeignTUIndex = *Index - NumLocalTUs;
+ if (ForeignTUIndex >= NameIdx->getForeignTUCount())
+ return std::nullopt; // Invalid foreign TU index.
+ return NameIdx->getForeignTUSignature(ForeignTUIndex);
+}
+
+std::optional<uint64_t>
+DWARFDebugNames::Entry::getForeignTUSkeletonCUOffset() const {
+ // Must have a DW_IDX_type_unit and it must be a foreign type unit.
+ if (!getForeignTUTypeSignature())
----------------
clayborg wrote:
Spec states:
```
6.1.1.4.2 List of CUs
The list of CUs immediately follows the header. Each entry in the list is an
offset of the corresponding compilation unit in the .debug_info section. In the
DWARF-32 format, a section offset is 4 bytes, while in the DWARF-64 format, a
section offset is 8 bytes.
The total number of entries in the list is given by comp_unit_count. There must
be at least one CU.
```
https://github.com/llvm/llvm-project/pull/87740
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits