[llvm] 5e017c1 - [DWARF] Allow empty address range tables.

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 21:43:27 PST 2020


Author: Igor Kudrin
Date: 2020-01-23T12:41:04+07:00
New Revision: 5e017c12d22ab48aae34dced543bdbeba9b9893c

URL: https://github.com/llvm/llvm-project/commit/5e017c12d22ab48aae34dced543bdbeba9b9893c
DIFF: https://github.com/llvm/llvm-project/commit/5e017c12d22ab48aae34dced543bdbeba9b9893c.diff

LOG: [DWARF] Allow empty address range tables.

Empty address range tables are allowed by the DWARF standard;
Moreover, generating them is recommended as a best practice, see
http://wiki.dwarfstd.org/index.php?title=Best_Practices#Generating_.debug_aranges_data

Differential Revision: https://reviews.llvm.org/D71931

Added: 
    llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
index 200b2d52a02b..b8478bdc48f9 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
@@ -90,10 +90,10 @@ DWARFDebugArangeSet::extract(DataExtractor data, uint64_t *offset_ptr) {
       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;
 }

diff  --git a/llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s b/llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s
new file mode 100644
index 000000000000..0ee166da4c22
--- /dev/null
+++ b/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:


        


More information about the llvm-commits mailing list