319 lines · plain
1# Test that the DWARF parser assigns the right scope to the2# variable `b`, which is `local` and not `static`.3 4# Original test case (for future reference), compiled with:5# $ clang-10 -g -Og test.c -o test6# $ cat test.c7# volatile int a;8# main() {9# int b = 3;10# a;11# }12 13# RUN: llvm-mc -triple=x86_64-apple-macosx10.15.0 -filetype=obj %s > %t.o14# RUN: lldb-test symbols %t.o | FileCheck %s15 16# CHECK: Variable{{.*}}, name = "b", type = {{.*}} (int), scope = local17 18 .section __TEXT,__text,regular,pure_instructions19 .macosx_version_min 10, 1520 .file 1 "/Users/davide/work/build/bin" "a.c"21 .globl _main ## -- Begin function main22 .p2align 4, 0x9023_main: ## @main24Lfunc_begin0:25 .loc 1 2 0 ## a.c:2:026 .cfi_startproc27## %bb.0:28 pushq %rbp29 .cfi_def_cfa_offset 1630 .cfi_offset %rbp, -1631 movq %rsp, %rbp32 .cfi_def_cfa_register %rbp33Ltmp0:34 ##DEBUG_VALUE: b <- 335 .loc 1 5 9 prologue_end ## a.c:5:936 movl _a(%rip), %eax37Ltmp1:38 .loc 1 7 5 ## a.c:7:539 xorl %eax, %eax40 popq %rbp41 retq42Ltmp2:43Lfunc_end0:44 .cfi_endproc45 ## -- End function46 .globl _a ## @a47.zerofill __DATA,__common,_a,4,248 .section __DWARF,__debug_abbrev,regular,debug49Lsection_abbrev:50 .byte 1 ## Abbreviation Code51 .byte 17 ## DW_TAG_compile_unit52 .byte 1 ## DW_CHILDREN_yes53 .byte 37 ## DW_AT_producer54 .byte 14 ## DW_FORM_strp55 .byte 19 ## DW_AT_language56 .byte 5 ## DW_FORM_data257 .byte 3 ## DW_AT_name58 .byte 14 ## DW_FORM_strp59 .ascii "\202|" ## DW_AT_LLVM_sysroot60 .byte 14 ## DW_FORM_strp61 .byte 16 ## DW_AT_stmt_list62 .byte 23 ## DW_FORM_sec_offset63 .byte 27 ## DW_AT_comp_dir64 .byte 14 ## DW_FORM_strp65 .ascii "\341\177" ## DW_AT_APPLE_optimized66 .byte 25 ## DW_FORM_flag_present67 .byte 17 ## DW_AT_low_pc68 .byte 1 ## DW_FORM_addr69 .byte 18 ## DW_AT_high_pc70 .byte 6 ## DW_FORM_data471 .byte 0 ## EOM(1)72 .byte 0 ## EOM(2)73 .byte 2 ## Abbreviation Code74 .byte 52 ## DW_TAG_variable75 .byte 0 ## DW_CHILDREN_no76 .byte 3 ## DW_AT_name77 .byte 14 ## DW_FORM_strp78 .byte 73 ## DW_AT_type79 .byte 19 ## DW_FORM_ref480 .byte 63 ## DW_AT_external81 .byte 25 ## DW_FORM_flag_present82 .byte 58 ## DW_AT_decl_file83 .byte 11 ## DW_FORM_data184 .byte 59 ## DW_AT_decl_line85 .byte 11 ## DW_FORM_data186 .byte 2 ## DW_AT_location87 .byte 24 ## DW_FORM_exprloc88 .byte 0 ## EOM(1)89 .byte 0 ## EOM(2)90 .byte 3 ## Abbreviation Code91 .byte 53 ## DW_TAG_volatile_type92 .byte 0 ## DW_CHILDREN_no93 .byte 73 ## DW_AT_type94 .byte 19 ## DW_FORM_ref495 .byte 0 ## EOM(1)96 .byte 0 ## EOM(2)97 .byte 4 ## Abbreviation Code98 .byte 36 ## DW_TAG_base_type99 .byte 0 ## DW_CHILDREN_no100 .byte 3 ## DW_AT_name101 .byte 14 ## DW_FORM_strp102 .byte 62 ## DW_AT_encoding103 .byte 11 ## DW_FORM_data1104 .byte 11 ## DW_AT_byte_size105 .byte 11 ## DW_FORM_data1106 .byte 0 ## EOM(1)107 .byte 0 ## EOM(2)108 .byte 5 ## Abbreviation Code109 .byte 46 ## DW_TAG_subprogram110 .byte 1 ## DW_CHILDREN_yes111 .byte 17 ## DW_AT_low_pc112 .byte 1 ## DW_FORM_addr113 .byte 18 ## DW_AT_high_pc114 .byte 6 ## DW_FORM_data4115 .byte 64 ## DW_AT_frame_base116 .byte 24 ## DW_FORM_exprloc117 .byte 122 ## DW_AT_call_all_calls118 .byte 25 ## DW_FORM_flag_present119 .byte 3 ## DW_AT_name120 .byte 14 ## DW_FORM_strp121 .byte 58 ## DW_AT_decl_file122 .byte 11 ## DW_FORM_data1123 .byte 59 ## DW_AT_decl_line124 .byte 11 ## DW_FORM_data1125 .byte 73 ## DW_AT_type126 .byte 19 ## DW_FORM_ref4127 .byte 63 ## DW_AT_external128 .byte 25 ## DW_FORM_flag_present129 .ascii "\341\177" ## DW_AT_APPLE_optimized130 .byte 25 ## DW_FORM_flag_present131 .byte 0 ## EOM(1)132 .byte 0 ## EOM(2)133 .byte 6 ## Abbreviation Code134 .byte 11 ## DW_TAG_lexical_block135 .byte 1 ## DW_CHILDREN_yes136 .byte 17 ## DW_AT_low_pc137 .byte 1 ## DW_FORM_addr138 .byte 18 ## DW_AT_high_pc139 .byte 6 ## DW_FORM_data4140 .byte 0 ## EOM(1)141 .byte 0 ## EOM(2)142 .byte 7 ## Abbreviation Code143 .byte 52 ## DW_TAG_variable144 .byte 0 ## DW_CHILDREN_no145 .byte 28 ## DW_AT_const_value146 .byte 13 ## DW_FORM_sdata147 .byte 3 ## DW_AT_name148 .byte 14 ## DW_FORM_strp149 .byte 58 ## DW_AT_decl_file150 .byte 11 ## DW_FORM_data1151 .byte 59 ## DW_AT_decl_line152 .byte 11 ## DW_FORM_data1153 .byte 73 ## DW_AT_type154 .byte 19 ## DW_FORM_ref4155 .byte 0 ## EOM(1)156 .byte 0 ## EOM(2)157 .byte 0 ## EOM(3)158 .section __DWARF,__debug_info,regular,debug159Lsection_info:160Lcu_begin0:161.set Lset0, Ldebug_info_end0-Ldebug_info_start0 ## Length of Unit162 .long Lset0163Ldebug_info_start0:164 .short 4 ## DWARF version number165.set Lset1, Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section166 .long Lset1167 .byte 8 ## Address Size (in bytes)168 .byte 1 ## Abbrev [1] 0xb:0x79 DW_TAG_compile_unit169 .long 0 ## DW_AT_producer170 .short 12 ## DW_AT_language171 .long 101 ## DW_AT_name172 .long 105 ## DW_AT_LLVM_sysroot173.set Lset2, Lline_table_start0-Lsection_line ## DW_AT_stmt_list174 .long Lset2175 .long 107 ## DW_AT_comp_dir176 ## DW_AT_APPLE_optimized177 .quad Lfunc_begin0 ## DW_AT_low_pc178.set Lset3, Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc179 .long Lset3180 .byte 2 ## Abbrev [2] 0x2e:0x15 DW_TAG_variable181 .long 136 ## DW_AT_name182 .long 67 ## DW_AT_type183 ## DW_AT_external184 .byte 1 ## DW_AT_decl_file185 .byte 1 ## DW_AT_decl_line186 .byte 9 ## DW_AT_location187 .byte 3188 .quad _a189 .byte 3 ## Abbrev [3] 0x43:0x5 DW_TAG_volatile_type190 .long 72 ## DW_AT_type191 .byte 4 ## Abbrev [4] 0x48:0x7 DW_TAG_base_type192 .long 138 ## DW_AT_name193 .byte 5 ## DW_AT_encoding194 .byte 4 ## DW_AT_byte_size195 .byte 5 ## Abbrev [5] 0x4f:0x34 DW_TAG_subprogram196 .quad Lfunc_begin0 ## DW_AT_low_pc197.set Lset4, Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc198 .long Lset4199 .byte 1 ## DW_AT_frame_base200 .byte 86201 ## DW_AT_call_all_calls202 .long 142 ## DW_AT_name203 .byte 1 ## DW_AT_decl_file204 .byte 2 ## DW_AT_decl_line205 .long 72 ## DW_AT_type206 ## DW_AT_external207 ## DW_AT_APPLE_optimized208 .byte 6 ## Abbrev [6] 0x68:0x1a DW_TAG_lexical_block209 .quad Ltmp0 ## DW_AT_low_pc210.set Lset5, Ltmp1-Ltmp0 ## DW_AT_high_pc211 .long Lset5212 .byte 7 ## Abbrev [7] 0x75:0xc DW_TAG_variable213 .byte 3 ## DW_AT_const_value214 .long 147 ## DW_AT_name215 .byte 1 ## DW_AT_decl_file216 .byte 4 ## DW_AT_decl_line217 .long 72 ## DW_AT_type218 .byte 0 ## End Of Children Mark219 .byte 0 ## End Of Children Mark220 .byte 0 ## End Of Children Mark221Ldebug_info_end0:222 .section __DWARF,__debug_str,regular,debug223Linfo_string:224 .asciz "clang version 11.0.0 (https://github.com/llvm/llvm-project f30ebf437851d3c68fd0eee82afbc0cef7373c00)" ## string offset=0225 .asciz "a.c" ## string offset=101226 .asciz "/" ## string offset=105227 .asciz "/Users/davide/work/build/bin" ## string offset=107228 .asciz "a" ## string offset=136229 .asciz "int" ## string offset=138230 .asciz "main" ## string offset=142231 .asciz "b" ## string offset=147232 .section __DWARF,__apple_names,regular,debug233Lnames_begin:234 .long 1212240712 ## Header Magic235 .short 1 ## Header Version236 .short 0 ## Header Hash Function237 .long 2 ## Header Bucket Count238 .long 2 ## Header Hash Count239 .long 12 ## Header Data Length240 .long 0 ## HeaderData Die Offset Base241 .long 1 ## HeaderData Atom Count242 .short 1 ## DW_ATOM_die_offset243 .short 6 ## DW_FORM_data4244 .long 0 ## Bucket 0245 .long -1 ## Bucket 1246 .long 177670 ## Hash in Bucket 0247 .long 2090499946 ## Hash in Bucket 0248.set Lset6, LNames0-Lnames_begin ## Offset in Bucket 0249 .long Lset6250.set Lset7, LNames1-Lnames_begin ## Offset in Bucket 0251 .long Lset7252LNames0:253 .long 136 ## a254 .long 1 ## Num DIEs255 .long 46256 .long 0257LNames1:258 .long 142 ## main259 .long 1 ## Num DIEs260 .long 79261 .long 0262 .section __DWARF,__apple_objc,regular,debug263Lobjc_begin:264 .long 1212240712 ## Header Magic265 .short 1 ## Header Version266 .short 0 ## Header Hash Function267 .long 1 ## Header Bucket Count268 .long 0 ## Header Hash Count269 .long 12 ## Header Data Length270 .long 0 ## HeaderData Die Offset Base271 .long 1 ## HeaderData Atom Count272 .short 1 ## DW_ATOM_die_offset273 .short 6 ## DW_FORM_data4274 .long -1 ## Bucket 0275 .section __DWARF,__apple_namespac,regular,debug276Lnamespac_begin:277 .long 1212240712 ## Header Magic278 .short 1 ## Header Version279 .short 0 ## Header Hash Function280 .long 1 ## Header Bucket Count281 .long 0 ## Header Hash Count282 .long 12 ## Header Data Length283 .long 0 ## HeaderData Die Offset Base284 .long 1 ## HeaderData Atom Count285 .short 1 ## DW_ATOM_die_offset286 .short 6 ## DW_FORM_data4287 .long -1 ## Bucket 0288 .section __DWARF,__apple_types,regular,debug289Ltypes_begin:290 .long 1212240712 ## Header Magic291 .short 1 ## Header Version292 .short 0 ## Header Hash Function293 .long 1 ## Header Bucket Count294 .long 1 ## Header Hash Count295 .long 20 ## Header Data Length296 .long 0 ## HeaderData Die Offset Base297 .long 3 ## HeaderData Atom Count298 .short 1 ## DW_ATOM_die_offset299 .short 6 ## DW_FORM_data4300 .short 3 ## DW_ATOM_die_tag301 .short 5 ## DW_FORM_data2302 .short 4 ## DW_ATOM_type_flags303 .short 11 ## DW_FORM_data1304 .long 0 ## Bucket 0305 .long 193495088 ## Hash in Bucket 0306.set Lset8, Ltypes0-Ltypes_begin ## Offset in Bucket 0307 .long Lset8308Ltypes0:309 .long 138 ## int310 .long 1 ## Num DIEs311 .long 72312 .short 36313 .byte 0314 .long 0315.subsections_via_symbols316 .section __DWARF,__debug_line,regular,debug317Lsection_line:318Lline_table_start0:319