1# DW_AT_ranges can use DW_FORM_sec_offset (instead of DW_FORM_rnglistx). 2# In such case DW_AT_rnglists_base does not need to be present. 3 4# REQUIRES: x86 5 6# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t 7# RUN: %lldb %t -o "image lookup -v -s lookup_rnglists" \ 8# RUN: -o exit | FileCheck %s 9 10# Failure was the block range 1..2 was not printed plus: 11# error: DW_AT_range-DW_FORM_sec_offset.s.tmp {0x000000000000003f}: DIE has DW_AT_ranges(0xc) attribute, but range extraction failed (missing or invalid range list table), please file a bug and attach the file at the start of this error message 12 13# CHECK-LABEL: image lookup -v -s lookup_rnglists 14# CHECK: Function: id = {0x00000029}, name = "rnglists", range = [0x0000000000000000-0x0000000000000003) 15# CHECK: Blocks: id = {0x00000029}, range = [0x00000000-0x00000003) 16# CHECK-NEXT: id = {0x0000003f}, range = [0x00000001-0x00000002) 17 18# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \ 19# RUN: --defsym RNGLISTX=0 %s > %t-rnglistx 20# RUN: %lldb %t-rnglistx -o "image lookup -v -s lookup_rnglists" \ 21# RUN: -o exit 2>%t.error | FileCheck --check-prefix=RNGLISTX %s 22# RUN: cat %t.error | FileCheck --check-prefix=ERROR %s 23 24# RNGLISTX-LABEL: image lookup -v -s lookup_rnglists 25# ERROR: error: {{.*}} [0x000000000000003f]: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0000000000000000) attribute, but range extraction failed (DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base for CU at 0x0000000000000000), please file a bug and attach the file at the start of this error message 26 27# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \ 28# RUN: --defsym RNGLISTX=0 --defsym RNGLISTBASE=0 %s > %t-rnglistbase 29# RUN: %lldb %t-rnglistbase -o "image lookup -v -s lookup_rnglists" \ 30# RUN: -o exit 2>%t.error | FileCheck --check-prefix=RNGLISTBASE %s 31# RUN: cat %t.error | FileCheck --check-prefix=ERRORBASE %s 32 33# RNGLISTBASE-LABEL: image lookup -v -s lookup_rnglists 34# ERRORBASE: error: {{.*}}-rnglistbase [0x0000000000000043]: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0000000000000000) attribute, but range extraction failed (invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base is 24), please file a bug and attach the file at the start of this error message 35 36 .text 37rnglists: 38 nop 39.Lblock1_begin: 40lookup_rnglists: 41 nop 42.Lblock1_end: 43 nop 44.Lrnglists_end: 45 46 .section .debug_abbrev,"",@progbits 47 .byte 1 # Abbreviation Code 48 .byte 17 # DW_TAG_compile_unit 49 .byte 1 # DW_CHILDREN_yes 50 .byte 37 # DW_AT_producer 51 .byte 8 # DW_FORM_string 52 .byte 17 # DW_AT_low_pc 53 .byte 27 # DW_FORM_addrx 54 .byte 18 # DW_AT_high_pc 55 .byte 6 # DW_FORM_data4 56 .byte 115 # DW_AT_addr_base 57 .byte 23 # DW_FORM_sec_offset 58.ifdef RNGLISTBASE 59 .byte 0x74 # DW_AT_rnglists_base 60 .byte 23 # DW_FORM_sec_offset 61.endif 62 .byte 0 # EOM(1) 63 .byte 0 # EOM(2) 64 .byte 2 # Abbreviation Code 65 .byte 46 # DW_TAG_subprogram 66 .byte 1 # DW_CHILDREN_yes 67 .byte 17 # DW_AT_low_pc 68 .byte 1 # DW_FORM_addr 69 .byte 18 # DW_AT_high_pc 70 .byte 6 # DW_FORM_data4 71 .byte 3 # DW_AT_name 72 .byte 8 # DW_FORM_string 73 .byte 0 # EOM(1) 74 .byte 0 # EOM(2) 75 .byte 5 # Abbreviation Code 76 .byte 11 # DW_TAG_lexical_block 77 .byte 0 # DW_CHILDREN_no 78 .byte 85 # DW_AT_ranges 79.ifndef RNGLISTX 80 .byte 0x17 # DW_FORM_sec_offset 81.else 82 .byte 0x23 # DW_FORM_rnglistx 83.endif 84 .byte 0 # EOM(1) 85 .byte 0 # EOM(2) 86 .byte 0 # EOM(3) 87 88 .section .debug_info,"",@progbits 89.Lcu_begin0: 90 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 91.Ldebug_info_start0: 92 .short 5 # DWARF version number 93 .byte 1 # DWARF Unit Type 94 .byte 8 # Address Size (in bytes) 95 .long .debug_abbrev # Offset Into Abbrev. Section 96 .byte 1 # Abbrev [1] 0xc:0x5f DW_TAG_compile_unit 97 .asciz "Hand-written DWARF" # DW_AT_producer 98 .byte 0 # DW_AT_low_pc 99 .long .Lrnglists_end-rnglists # DW_AT_high_pc 100 .long .Laddr_table_base0 # DW_AT_addr_base 101.ifdef RNGLISTBASE 102 .long .Ldebug_ranges1 # DW_AT_rnglists_base 103.endif 104 .byte 2 # Abbrev [2] 0x2b:0x37 DW_TAG_subprogram 105 .quad rnglists # DW_AT_low_pc 106 .long .Lrnglists_end-rnglists # DW_AT_high_pc 107 .asciz "rnglists" # DW_AT_name 108 .byte 5 # Abbrev [5] 0x52:0xf DW_TAG_lexical_block 109.ifndef RNGLISTX 110 .long .Ldebug_ranges1 # DW_AT_ranges DW_FORM_sec_offset 111.else 112 .uleb128 0 # DW_AT_ranges DW_FORM_rnglistx 113.endif 114 .byte 0 # End Of Children Mark 115 .byte 0 # End Of Children Mark 116.Ldebug_info_end0: 117 118 .section .debug_addr,"",@progbits 119 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution 120.Ldebug_addr_start0: 121 .short 5 # DWARF version number 122 .byte 8 # Address size 123 .byte 0 # Segment selector size 124.Laddr_table_base0: 125 .quad rnglists 126.Ldebug_addr_end0: 127 128 .section .debug_rnglists,"",@progbits 129 .long .Ldebug_rnglist_table_end0-.Ldebug_rnglist_table_start0 # Length 130.Ldebug_rnglist_table_start0: 131 .short 5 # Version 132 .byte 8 # Address size 133 .byte 0 # Segment selector size 134 .long 0 # Offset entry count 135.Ldebug_rnglist_table_end0: 136 137 .long .Ldebug_rnglist_table_end1-.Ldebug_rnglist_table_start1 # Length 138.Ldebug_rnglist_table_start1: 139 .short 5 # Version 140 .byte 8 # Address size 141 .byte 0 # Segment selector size 142 .long 0 # Offset entry count 143.Ldebug_ranges1: 144 .byte 4 # DW_RLE_offset_pair 145 .uleb128 .Lblock1_begin-rnglists # starting offset 146 .uleb128 .Lblock1_end-rnglists # ending offset 147 .byte 0 # DW_RLE_end_of_list 148.Ldebug_rnglist_table_end1: 149