263 lines · plain
1# Test location list handling, including the cases of invalid input. The exact2# behavior in the invalid cases is not particularly important, but it should be3# "reasonable".4 5# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s --defsym LOC=0 > %t6# RUN: %lldb %t -o "image lookup -v -a 0" -o "image lookup -v -a 2" \7# RUN: -o "image dump symfile" -o exit | FileCheck %s8 9# RUN: %lldb %t -o "image lookup -v -a 0 -show-variable-ranges" -o \10# RUN: "image lookup -v -a 2 -show-variable-ranges" \11# RUN: -o exit | FileCheck %s --check-prefix=ALL-RANGES12 13# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s --defsym LOCLISTS=0 > %t14# RUN: %lldb %t -o "image lookup -v -a 0" -o "image lookup -v -a 2" \15# RUN: -o "image dump symfile" -o exit | FileCheck %s --check-prefix=CHECK --check-prefix=LOCLISTS16 17# ALL-RANGES-LABEL: image lookup -v -a 0 -show-variable-ranges18# ALL-RANGES: Variable: id = {{.*}}, name = "x0", type = "int", valid ranges = <block>, location = [0x0000000000000000, 0x0000000000000001) -> DW_OP_reg5 RDI, [0x0000000000000001, 0x0000000000000006) -> DW_OP_reg0 RAX19# ALL-RANGES: Variable: id = {{.*}}, name = "x1", type = "int", valid ranges = <block>, location = <empty>20# ALL-RANGES-LABEL: image lookup -v -a 2 -show-variable-ranges21# ALL-RANGES: Variable: id = {{.*}}, name = "x0", type = "int", valid ranges = <block>, location = [0x0000000000000000, 0x0000000000000001) -> DW_OP_reg5 RDI, [0x0000000000000001, 0x0000000000000006) -> DW_OP_reg0 RAX22# ALL-RANGES: Variable: id = {{.*}}, name = "x1", type = "int", valid ranges = <block>, location = <empty>23# ALL-RANGES: Variable: id = {{.*}}, name = "x3", type = "int", valid ranges = <block>, location = [0x0000000000000002, 0x0000000000000003) -> DW_OP_reg1 RDX24 25# CHECK-LABEL: image lookup -v -a 026# CHECK: Variable: {{.*}}, name = "x0", type = "int", valid ranges = <block>, location = [0x0000000000000000, 0x0000000000000001) -> DW_OP_reg5 RDI27# CHECK: Variable: {{.*}}, name = "x1", type = "int", valid ranges = <block>, location = <empty>,28 29# CHECK-LABEL: image lookup -v -a 230# CHECK: Variable: {{.*}}, name = "x0", type = "int", valid ranges = <block>, location = [0x0000000000000001, 0x0000000000000006) -> DW_OP_reg0 RAX31# CHECK: Variable: {{.*}}, name = "x1", type = "int", valid ranges = <block>, location = <empty>,32# CHECK: Variable: {{.*}}, name = "x3", type = "int", valid ranges = <block>, location = [0x0000000000000002, 0x0000000000000003) -> DW_OP_reg1 RDX33 34# CHECK-LABEL: image dump symfile35# CHECK: CompileUnit{0x00000000}36# CHECK: Function{37# CHECK: Variable{{.*}}, name = "x0", {{.*}}, scope = parameter, location =38# CHECK-NEXT: [0x0000000000000000, 0x0000000000000001): DW_OP_reg5 RDI39# CHECK-NEXT: [0x0000000000000001, 0x0000000000000006): DW_OP_reg0 RAX40# CHECK: Variable{{.*}}, name = "x1", {{.*}}, scope = parameter41# CHECK: Variable{{.*}}, name = "x2", {{.*}}, scope = parameter42# CHECK: Variable{{.*}}, name = "x3", {{.*}}, scope = parameter, location =43# CHECK-NEXT: [0x0000000000000002, 0x0000000000000003): DW_OP_reg1 RDX44# LOCLISTS: Variable{{.*}}, name = "x4", {{.*}}, scope = parameter45# LOCLISTS-EMPTY:46 47.ifdef LOC48.macro OFFSET_PAIR lo hi49 .quad \lo50 .quad \hi51.endm52 53.macro BASE_ADDRESS base54 .quad -155 .quad \base56.endm57 58.macro EXPR_SIZE sz59 .short \sz60.endm61 62.macro END_OF_LIST63 .quad 064 .quad 065.endm66.endif67 68.ifdef LOCLISTS69.macro OFFSET_PAIR lo hi70 .byte 4 # DW_LLE_offset_pair71 .uleb128 \lo72 .uleb128 \hi73.endm74 75.macro BASE_ADDRESS base76 .byte 6 # DW_LLE_base_address77 .quad \base78.endm79 80.macro EXPR_SIZE sz81 .uleb128 \sz82.endm83 84.macro END_OF_LIST85 .byte 0 # DW_LLE_end_of_list86.endm87.endif88 89 .type f,@function90f: # @f91.Lfunc_begin0:92 nop93.Ltmp0:94 nop95.Ltmp1:96 nop97.Ltmp2:98 nop99.Ltmp3:100 nop101.Ltmp4:102 nop103.Lfunc_end0:104 .size f, .Lfunc_end0-f105 106 .section .debug_str,"MS",@progbits,1107.Linfo_string0:108 .asciz "Hand-written DWARF"109.Linfo_string3:110 .asciz "f"111.Linfo_string4:112 .asciz "int"113 114.ifdef LOC115 .section .debug_loc,"",@progbits116.endif117.ifdef LOCLISTS118 .section .debug_loclists,"",@progbits119 .long .Ldebug_loclist_table_end0-.Ldebug_loclist_table_start0 # Length120.Ldebug_loclist_table_start0:121 .short 5 # Version122 .byte 8 # Address size123 .byte 0 # Segment selector size124 .long 0 # Offset entry count125.endif126.Ldebug_loc0:127 OFFSET_PAIR .Lfunc_begin0-.Lfunc_begin0, .Ltmp0-.Lfunc_begin0128 EXPR_SIZE 1129 .byte 85 # super-register DW_OP_reg5130 OFFSET_PAIR .Ltmp0-.Lfunc_begin0, .Lfunc_end0-.Lfunc_begin0131 EXPR_SIZE 1132 .byte 80 # super-register DW_OP_reg0133 END_OF_LIST134 135.Ldebug_loc3:136 BASE_ADDRESS .Ltmp1137 OFFSET_PAIR .Ltmp1-.Ltmp1, .Ltmp2-.Ltmp1138 EXPR_SIZE 1139 .byte 81 # super-register DW_OP_reg1140 END_OF_LIST141 142.ifdef LOCLISTS143.Ldebug_loc4:144 .byte 3 # DW_LLE_startx_length145 .uleb128 0xdead146 .uleb128 1147 EXPR_SIZE 1148 .byte 82 # super-register DW_OP_reg2149 END_OF_LIST150.endif151 152.Ldebug_loc2:153 OFFSET_PAIR .Lfunc_begin0-.Lfunc_begin0, .Lfunc_end0-.Lfunc_begin0154 EXPR_SIZE 0xdead155.Ldebug_loclist_table_end0:156 157 .section .debug_abbrev,"",@progbits158 .byte 1 # Abbreviation Code159 .byte 17 # DW_TAG_compile_unit160 .byte 1 # DW_CHILDREN_yes161 .byte 37 # DW_AT_producer162 .byte 14 # DW_FORM_strp163 .byte 19 # DW_AT_language164 .byte 5 # DW_FORM_data2165 .byte 17 # DW_AT_low_pc166 .byte 1 # DW_FORM_addr167 .byte 18 # DW_AT_high_pc168 .byte 6 # DW_FORM_data4169 .byte 0 # EOM(1)170 .byte 0 # EOM(2)171 .byte 2 # Abbreviation Code172 .byte 46 # DW_TAG_subprogram173 .byte 1 # DW_CHILDREN_yes174 .byte 17 # DW_AT_low_pc175 .byte 1 # DW_FORM_addr176 .byte 18 # DW_AT_high_pc177 .byte 6 # DW_FORM_data4178 .byte 3 # DW_AT_name179 .byte 14 # DW_FORM_strp180 .byte 73 # DW_AT_type181 .byte 19 # DW_FORM_ref4182 .byte 0 # EOM(1)183 .byte 0 # EOM(2)184 .byte 3 # Abbreviation Code185 .byte 5 # DW_TAG_formal_parameter186 .byte 0 # DW_CHILDREN_no187 .byte 2 # DW_AT_location188 .byte 23 # DW_FORM_sec_offset189 .byte 3 # DW_AT_name190 .byte 8 # DW_FORM_string191 .byte 73 # DW_AT_type192 .byte 19 # DW_FORM_ref4193 .byte 0 # EOM(1)194 .byte 0 # EOM(2)195 .byte 4 # Abbreviation Code196 .byte 36 # DW_TAG_base_type197 .byte 0 # DW_CHILDREN_no198 .byte 3 # DW_AT_name199 .byte 14 # DW_FORM_strp200 .byte 62 # DW_AT_encoding201 .byte 11 # DW_FORM_data1202 .byte 11 # DW_AT_byte_size203 .byte 11 # DW_FORM_data1204 .byte 0 # EOM(1)205 .byte 0 # EOM(2)206 .byte 0 # EOM(3)207 208 .section .debug_info,"",@progbits209.Lcu_begin0:210 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit211.Ldebug_info_start0:212.ifdef LOC213 .short 4 # DWARF version number214 .long .debug_abbrev # Offset Into Abbrev. Section215 .byte 8 # Address Size (in bytes)216.endif217.ifdef LOCLISTS218 .short 5 # DWARF version number219 .byte 1 # DWARF Unit Type220 .byte 8 # Address Size (in bytes)221 .long .debug_abbrev # Offset Into Abbrev. Section222.endif223 .byte 1 # Abbrev [1] 0xb:0x50 DW_TAG_compile_unit224 .long .Linfo_string0 # DW_AT_producer225 .short 12 # DW_AT_language226 .quad .Lfunc_begin0 # DW_AT_low_pc227 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc228 .byte 2 # Abbrev [2] 0x2a:0x29 DW_TAG_subprogram229 .quad .Lfunc_begin0 # DW_AT_low_pc230 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc231 .long .Linfo_string3 # DW_AT_name232 .long .Lint # DW_AT_type233 .byte 3 # Abbrev [3] DW_TAG_formal_parameter234 .long .Ldebug_loc0 # DW_AT_location235 .asciz "x0" # DW_AT_name236 .long .Lint-.Lcu_begin0 # DW_AT_type237 .byte 3 # Abbrev [3] DW_TAG_formal_parameter238 .long 0xdeadbeef # DW_AT_location239 .asciz "x1" # DW_AT_name240 .long .Lint-.Lcu_begin0 # DW_AT_type241 .byte 3 # Abbrev [3] DW_TAG_formal_parameter242 .long .Ldebug_loc2 # DW_AT_location243 .asciz "x2" # DW_AT_name244 .long .Lint-.Lcu_begin0 # DW_AT_type245 .byte 3 # Abbrev [3] DW_TAG_formal_parameter246 .long .Ldebug_loc3 # DW_AT_location247 .asciz "x3" # DW_AT_name248 .long .Lint-.Lcu_begin0 # DW_AT_type249.ifdef LOCLISTS250 .byte 3 # Abbrev [3] DW_TAG_formal_parameter251 .long .Ldebug_loc4 # DW_AT_location252 .asciz "x4" # DW_AT_name253 .long .Lint-.Lcu_begin0 # DW_AT_type254.endif255 .byte 0 # End Of Children Mark256.Lint:257 .byte 4 # Abbrev [4] 0x53:0x7 DW_TAG_base_type258 .long .Linfo_string4 # DW_AT_name259 .byte 5 # DW_AT_encoding260 .byte 4 # DW_AT_byte_size261 .byte 0 # End Of Children Mark262.Ldebug_info_end0:263