[llvm] Aggregate errors from llvm-dwarfutil --verify (PR #79648)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 15:34:17 PST 2024


================
@@ -167,20 +167,24 @@ bool DWARFVerifier::verifyUnitHeader(const DWARFDataExtractor DebugInfoData,
   if (!ValidLength || !ValidVersion || !ValidAddrSize || !ValidAbbrevOffset ||
       !ValidType) {
     Success = false;
-    error() << format("Units[%d] - start offset: 0x%08" PRIx64 " \n", UnitIndex,
-                      OffsetStart);
-    if (!ValidLength)
-      note() << "The length for this unit is too "
-                "large for the .debug_info provided.\n";
-    if (!ValidVersion)
-      note() << "The 16 bit unit header version is not valid.\n";
-    if (!ValidType)
-      note() << "The unit type encoding is not valid.\n";
-    if (!ValidAbbrevOffset)
-      note() << "The offset into the .debug_abbrev section is "
-                "not valid.\n";
-    if (!ValidAddrSize)
-      note() << "The address size is unsupported.\n";
+    ErrorCategory.Report("Invalid Length in Unit Header", [&]() {
----------------
dwblaikie wrote:

Awkward introducing new category names when there's nothing in the diagnostic itself that tells you it's part of a category (unlike, say, clang's diagnostic groups which are rendered in the diagnostic by default with the `[-Wunused]` or whatever after the diagnostic message) - could that be addressed in some way to make it clearer how these categories relate to the specific messages? (like if you wanted to grep for all the messages under a category to diff them against a baseline if you found the number went up or down)

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


More information about the llvm-commits mailing list