1# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t 2# RUN: llvm-dwarfdump -v %t 2>%t.err | FileCheck %s 3# RUN: FileCheck %s <%t.err -check-prefix=ERR 4 5# CHECK: .debug_info contents: 6# CHECK: 0x0000000b: DW_TAG_compile_unit [1] 7# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) 8# CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000 9# CHECK-NEXT: [0x0000000000000000, 0x0000000000000001) ".text" 10# CHECK-NEXT: [0x0000000000000003, 0x0000000000000006) ".text" 11# CHECK-NEXT: [0x0000000000000001, 0x0000000000000002) ".text.foo1") 12 13.text 14.globl foo 15.type foo,@function 16foo: 17.Lfunc_begin0: 18 nop 19.Ltmp0: 20 nop 21 nop 22.Ltmp1: 23 nop 24 nop 25 nop 26.Ltmp2: 27 28.section .text.foo1,"ax",@progbits 29.Ltmp3: 30 nop 31.Ltmp4: 32 nop 33.Ltmp5: 34 35.section .debug_abbrev,"",@progbits 36.byte 1 # Abbreviation Code 37.byte 17 # DW_TAG_compile_unit 38.byte 0 # DW_CHILDREN_no 39.byte 37 # DW_AT_producer 40.byte 14 # DW_FORM_strp 41.byte 19 # DW_AT_language 42.byte 5 # DW_FORM_data2 43.byte 3 # DW_AT_name 44.byte 14 # DW_FORM_strp 45.byte 16 # DW_AT_stmt_list 46.byte 23 # DW_FORM_sec_offset 47.byte 27 # DW_AT_comp_dir 48.byte 14 # DW_FORM_strp 49.byte 17 # DW_AT_low_pc 50.byte 1 # DW_FORM_addr 51.byte 85 # DW_AT_ranges 52.byte 23 # DW_FORM_sec_offset 53.byte 0 # EOM(1) 54.byte 0 # EOM(2) 55.byte 0 # EOM(3) 56 57.section .debug_info,"",@progbits 58.Lcu_begin0: 59.long 38 # Length of Unit 60.short 4 # DWARF version number 61.long .debug_abbrev # Offset Into Abbrev. Section 62.byte 8 # Address Size (in bytes) 63.byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit 64.long 0 # DW_AT_producer 65.short 4 # DW_AT_language 66.long 0 # DW_AT_name 67.long 0 # DW_AT_stmt_list 68.long 0 # DW_AT_comp_dir 69.quad .Lfunc_begin0 # DW_AT_low_pc 70.long .Ldebug_ranges0 # DW_AT_ranges 71 72# A CU with an invalid DW_AT_ranges attribute 73.Lcu_begin1: 74.long 38 # Length of Unit 75.short 4 # DWARF version number 76.long .debug_abbrev # Offset Into Abbrev. Section 77.byte 8 # Address Size (in bytes) 78.byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit 79.long 0 # DW_AT_producer 80.short 4 # DW_AT_language 81.long 0 # DW_AT_name 82.long 0 # DW_AT_stmt_list 83.long 0 # DW_AT_comp_dir 84.quad .Lfunc_begin0 # DW_AT_low_pc 85.long 0x4000 # DW_AT_ranges 86 87# ERR: error: decoding address ranges: invalid range list offset 0x4000 88 89# A CU where the DW_AT_ranges attribute points to an invalid range list. 90.Lcu_begin2: 91.long 38 # Length of Unit 92.short 4 # DWARF version number 93.long .debug_abbrev # Offset Into Abbrev. Section 94.byte 8 # Address Size (in bytes) 95.byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit 96.long 0 # DW_AT_producer 97.short 4 # DW_AT_language 98.long 0 # DW_AT_name 99.long 0 # DW_AT_stmt_list 100.long 0 # DW_AT_comp_dir 101.quad .Lfunc_begin0 # DW_AT_low_pc 102.long .Ldebug_ranges1 # DW_AT_ranges 103 104.section .debug_ranges,"",@progbits 105.Ldebug_ranges0: 106 .quad .Lfunc_begin0-.Lfunc_begin0 107 .quad .Ltmp0-.Lfunc_begin0 108 .quad .Ltmp1-.Lfunc_begin0 109 .quad .Ltmp2-.Lfunc_begin0 110 .quad 0xFFFFFFFFFFFFFFFF 111 .quad .text.foo1 112 .quad .Ltmp4-.text.foo1 113 .quad .Ltmp5-.text.foo1 114 .quad 0 115 .quad 0 116.Ldebug_ranges1: 117 .quad 0 118 119# ERR: error: decoding address ranges: invalid range list entry at offset 0x50 120