[PATCH] D148578: [dwarfdump][dwarf] Fix parsing of tu-index

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 16:01:01 PDT 2023


ayermolo created this revision.
Herald added subscribers: hoy, modimo, wenlei, arphaman, hiraditya.
Herald added a project: All.
ayermolo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Fixed issue where {tu,cu}-index fixup code for DWARF5 that would report an error when
fixup map is empty. Which is the case when seciton(s) are not over 4GB or
--manaully-generate-unit-index is not specified


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148578

Files:
  llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  llvm/test/DebugInfo/X86/dwp-v5-tu-index.s


Index: llvm/test/DebugInfo/X86/dwp-v5-tu-index.s
===================================================================
--- llvm/test/DebugInfo/X86/dwp-v5-tu-index.s
+++ llvm/test/DebugInfo/X86/dwp-v5-tu-index.s
@@ -1,11 +1,12 @@
 ## The test checks that we can parse and dump a TU index section that is
 ## compliant to the DWARFv5 standard.
 
-# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
-# RUN:   llvm-dwarfdump -debug-tu-index - | \
-# RUN:   FileCheck %s
+# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
+# RUN:   llvm-dwarfdump %t.o -debug-tu-index &> %t.txt
+# RUN:   cat %t.txt | FileCheck %s
 
 # CHECK:      .debug_tu_index contents:
+# CHECK-NOT: Could not find unit with signature 0x1100001122222222 in the Map
 # CHECK-NEXT: version = 5, units = 1, slots = 2
 # CHECK-EMPTY:
 # CHECK-NEXT: Index Signature          INFO                                     ABBREV                   LINE                     STR_OFFSETS
Index: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -869,6 +869,8 @@
       Offset = Header.getNextUnitOffset();
     }
   });
+  if (Map.empty())
+    return;
   for (DWARFUnitIndex::Entry &E : Index.getMutableRows()) {
     if (!E.isValid())
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148578.514443.patch
Type: text/x-patch
Size: 1396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230417/31b61385/attachment.bin>


More information about the llvm-commits mailing list