1# This test verifies that an empty range list in the .debug_ranges section 2# doesn't crash llvm-dsymutil. As clang does not produce this kind of debug 3# info anymore, we used this hand-crafted assembly file to produce a testcase 4# Compile with: 5# llvm-mc -triple x86_64-apple-darwin -filetype=obj -o 1.o empty_range.o 6 7# RUN: llvm-dsymutil -f -y %p/dummy-debug-map.map -oso-prepend-path %p/../Inputs/empty_range -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s 8 9 .section __TEXT,__text,regular,pure_instructions 10 .macosx_version_min 10, 11 11 .globl __Z3foov 12 .align 4, 0x90 13__Z3foov: ## @_Z3foov 14Lfunc_begin0: 15 pushq %rbp 16 movq %rsp, %rbp 17 popq %rbp 18 retq 19Lfunc_end0: 20 .section __DWARF,__debug_abbrev,regular,debug 21Lsection_abbrev: 22 .byte 1 ## Abbreviation Code 23 .byte 17 ## DW_TAG_compile_unit 24 .byte 1 ## DW_CHILDREN_yes 25 .byte 0 ## EOM(1) 26 .byte 0 ## EOM(2) 27 .byte 2 ## Abbreviation Code 28 .byte 46 ## DW_TAG_subprogram 29 .byte 0 ## DW_CHILDREN_no 30 .byte 17 ## DW_AT_low_pc 31 .byte 1 ## DW_FORM_addr 32 .byte 0x55 ## DW_AT_ranges 33 .byte 6 ## DW_FORM_data4 34 .byte 0 ## EOM(1) 35 .byte 0 ## EOM(2) 36 .byte 0 ## EOM(3) 37 .section __DWARF,__debug_info,regular,debug 38Lsection_info: 39 .long 22 ## Length of Unit 40 .short 2 ## DWARF version number 41 .long 0 ## Offset Into Abbrev. Section 42 .byte 8 ## Address Size (in bytes) 43 .byte 1 ## Abbrev [1] DW_TAG_compile_unit 44 .byte 2 ## Abbrev [2] DW_TAG_subprogram 45 .quad Lfunc_begin0 ## DW_AT_low_pc 46 .long 0 ## DW_AT_ranges (pointing at an empty entry) 47 .byte 0 ## End Of Children Mark 48 .section __DWARF,__debug_ranges,regular,debug 49Ldebug_range: 50 .long 0 51 .long 0 52 53# CHECK: DW_TAG_compile_unit 54# CHECK: DW_TAG_subprogram 55# CHECK-NEXT: DW_AT_low_pc{{.*}}(0x0000000000010000) 56# CHECK-NEXT: DW_AT_ranges{{.*}}(0x00000000) 57 58# There was a bug that would use the currently active object file when a 59# debug map object isn't found. Check that we only linked one file. 60# CHECK-NOT: DW_TAG_compile_unit 61 62