[llvm] Add support for verifying local type units in .debug_names. (PR #101133)

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 05:24:33 PDT 2024


================
@@ -1512,7 +1512,8 @@ DWARFVerifier::verifyNameIndexAbbrevs(const DWARFDebugNames::NameIndex &NI) {
       NumErrors += verifyNameIndexAttribute(NI, Abbrev, AttrEnc);
     }
 
-    if (NI.getCUCount() > 1 && !Attributes.count(dwarf::DW_IDX_compile_unit)) {
+    if (NI.getCUCount() > 1 && !Attributes.count(dwarf::DW_IDX_compile_unit) &&
+        !Attributes.count(dwarf::DW_IDX_type_unit)) {
       ErrorCategory.Report("Abbreviation contains no attribute", [&]() {
         error() << formatv("NameIndex @ {0:x}: Indexing multiple compile units "
                            "and abbreviation {1:x} has no {2} attribute.\n",
----------------
labath wrote:

Yes, but is it the correct error message in the presence of type units? Like, if you have an index entry with only a DW_IDX_die_offset value, can you be certain that it's missing a DW_IDX_compile_unit value? I think not because, for all we know, it could be a type entry with a "forgotten" DW_IDX_type_unit key.

That's the distinction I wanted to capture here...

https://github.com/llvm/llvm-project/pull/101133


More information about the llvm-commits mailing list