[PATCH] D71931: [DWARF] Allow empty address range tables.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 06:16:33 PST 2020


ikudrin updated this revision to Diff 237650.
ikudrin added a comment.

- Use hardcoded padding.

It looks like I was not very convincing about the macro for calculating the padding. Moreover, as I am adding gtest-based unit tests in other patches, and they anyway use hardcoded paddings, it makes less sense to have that intricate calculation anymore.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71931/new/

https://reviews.llvm.org/D71931

Files:
  llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
  llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s


Index: llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s
@@ -0,0 +1,24 @@
+# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
+# RUN:  llvm-dwarfdump -debug-aranges - 2>&1 | \
+# RUN:  FileCheck %s
+
+    .section .debug_aranges,"", at progbits
+# CHECK: .debug_aranges contents:
+
+## Check that an empty set of ranges is supported.
+    .long   .L1end - .L1version     # Length
+# CHECK: Address Range Header: length = 0x00000014,
+.L1version:
+    .short  2                       # Version
+    .long   0x3456789a              # Debug Info Offset
+    .byte   4                       # Address Size
+    .byte   0                       # Segment Selector Size
+# CHECK-SAME: version = 0x0002,
+# CHECK-SAME: cu_offset = 0x3456789a,
+# CHECK-SAME: addr_size = 0x04,
+# CHECK-SAME: seg_size = 0x00
+    .space 4                        # Padding
+.L1tuples:
+    .long   0, 0                    # Termination tuple
+# CHECK-NOT: [0x
+.L1end:
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
@@ -90,10 +90,10 @@
       if (arangeDescriptor.Address || arangeDescriptor.Length)
         ArangeDescriptors.push_back(arangeDescriptor);
       else
-        break; // We are done if we get a zero address and length
+        return true; // We are done if we get a zero address and length
     }
 
-    return !ArangeDescriptors.empty();
+    return false; // No termination tuple is found.
   }
   return false;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71931.237650.patch
Type: text/x-patch
Size: 1743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200113/44a0155d/attachment.bin>


More information about the llvm-commits mailing list