[Lldb-commits] [lldb] [llvm] Add support for using foreign type units in .debug_names. (PR #87740)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 7 22:27:18 PDT 2024
================
@@ -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:
How can you end up with a .debug_names table that contains only one type unit? If this can happen, I can modify getForeignTUTypeSignature() to do the right thing. But file would need to have a single foreign or local TU only, and no CUs at all?
https://github.com/llvm/llvm-project/pull/87740
More information about the lldb-commits
mailing list