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; } Index: llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s =================================================================== --- /dev/null +++ llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s @@ -0,0 +1,35 @@ +# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \ +# RUN: llvm-dwarfdump -debug-aranges - 2>&1 | \ +# RUN: FileCheck %s + +## The first tuple following the header in each set begins at an offset that is +## a multiple of the size of a single tuple [DWARF4 7.20, DWARF5 7.21]. +## As this alignment must be relative to the header of the set, not to the +## section, the assembler alignment commands cannot be used if more than one set +## of entries resides in the single .debug_aranges section. +## This macro helps to insert the appropriate padding. +.macro add_aranges_padding set_header, tuple_size + .space (\tuple_size - 1) - (. - \set_header + \tuple_size - 1) % \tuple_size +.endm + + .section .debug_aranges,"",@progbits +# CHECK: .debug_aranges contents: + +## Check that an empty set of ranges is supported. +.L1: + .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 + add_aranges_padding .L1, 8 # Padding +.L1tuples: + .long 0, 0 # Termination tuple +# CHECK-NOT: [0x +.L1end: