[PATCH] D35643: [DWARF] Added check that verifies that no debugging information entry has more than one attribute with the same name.

Frederic Riss via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 14:16:22 PDT 2017


friss added inline comments.


================
Comment at: lib/DebugInfo/DWARF/DWARFVerifier.cpp:97-105
+    std::set<dwarf::Attribute> AttributeSet;
     for (auto AttrValue : Die.attributes()) {
+      if (AttributeSet.find(AttrValue.Attr) != AttributeSet.end()) {
+        OS << format("Error: Die at offset 0x%08x ", Die.getOffset());
+        OS << "contains multiple " << AttributeString(AttrValue.Attr)
+           << " attributes.\n";
+        ++NumUnitErrors;
----------------
While this is really simple, I feel like it's also really overkill to build a set for every DIE. Every DIE using the same abbreviation number will expose the same issue. Can we somehow prevent the duplicated work?


================
Comment at: test/tools/llvm-dwarfdump/X86/verify_debug_info.s:84
 	.byte	1                       ## DW_FORM_addr
-	.byte	18                      ## DW_AT_high_pc
+	.byte	17                      ## DW_AT_high_pc -- Error: Die at offset 0x0000002b contains multiple DW_AT_low_pc attributes.
 	.byte	6                       ## DW_FORM_data4
----------------
By adding this just to the abrrev table, I think you completely break the DIE tree decoding. Wouldn't it be better to add it to the debug_info section as well? 


https://reviews.llvm.org/D35643





More information about the llvm-commits mailing list