[Lldb-commits] [lldb] [llvm] Add support for using foreign type units in .debug_names. (PR #87740)
David Blaikie via lldb-commits
lldb-commits at lists.llvm.org
Sun Apr 14 19:05:41 PDT 2024
================
@@ -273,6 +301,44 @@ void DebugNamesDWARFIndex::GetFullyQualifiedType(
if (!isType(entry.tag()))
continue;
+
+ DWARFTypeUnit *foreign_tu = GetForeignTypeUnit(entry);
+ if (foreign_tu) {
+ // If this entry represents a foreign type unit, we need to verify that
+ // the type unit that ended up in the final .dwp file is the right type
+ // unit. Type units have signatures which are the same across multiple
+ // .dwo files, but only one of those type units will end up in the .dwp
+ // file. The contents of type units for the same type can be different
+ // in different .dwo file, which means the DIE offsets might not be the
+ // same between two different type units. So we need to determine if this
+ // accelerator table matches the type unit in the .dwp file. If it doesn't
+ // match, then we need to ignore this accelerator table entry as the type
+ // unit that is in the .dwp file will have its own index.
+ const llvm::DWARFDebugNames::NameIndex *name_index = entry.getNameIndex();
+ if (name_index == nullptr)
+ continue;
+ // In order to determine if the type unit that ended up in a .dwp file
+ // is valid, we need to grab the type unit and check the attribute on the
+ // type unit matches the .dwo file. For this to happen we rely on each
+ // .dwo file having its own .debug_names table with a single compile unit
+ // and multiple type units. This is the only way we can tell if a type
+ // unit came from a specific .dwo file.
----------------
dwblaikie wrote:
Ah, indeed - no, currently there's no well defined way to do LTO (LTO is basically the only time you get multiple CUs in a single .o straight out of the compiler) and Split DWARF (there's that long-standing issue that Cary and I should discuss how that should work & propose something to the DWARF committee, but we haven't as-yet).
I guess even if we did make that work, all the skeleton CUs in the dwo file would have the same DW_AT_dwo_name
https://github.com/llvm/llvm-project/pull/87740
More information about the lldb-commits
mailing list