1 # Test that the DWARF parser assigns the right scope to the
2 # variable `b`, which is `local` and not `static`.
4 # Original test case (for future reference), compiled with:
5 # $ clang-10 -g -Og test.c -o test
13 # RUN: llvm-mc -triple=x86_64-apple-macosx10.15.0 -filetype=obj %s > %t.o
14 # RUN: lldb-test symbols %t.o | FileCheck %s
16 # CHECK: Variable{{.*}}, name = "b", type = {{.*}} (int), scope = local
18 .section __TEXT,__text,regular,pure_instructions
19 .macosx_version_min 10, 15
20 .file 1 "/Users/davide/work/build/bin" "a.c"
21 .globl _main ## -- Begin function main
29 .cfi_def_cfa_offset 16
32 .cfi_def_cfa_register %rbp
35 .loc 1 5 9 prologue_end ## a.c:5:9
47 .zerofill __DATA,__common,_a,4,2
48 .section __DWARF,__debug_abbrev,regular,debug
50 .byte 1 ## Abbreviation Code
51 .byte 17 ## DW_TAG_compile_unit
52 .byte 1 ## DW_CHILDREN_yes
53 .byte 37 ## DW_AT_producer
54 .byte 14 ## DW_FORM_strp
55 .byte 19 ## DW_AT_language
56 .byte 5 ## DW_FORM_data2
58 .byte 14 ## DW_FORM_strp
59 .ascii "\202|" ## DW_AT_LLVM_sysroot
60 .byte 14 ## DW_FORM_strp
61 .byte 16 ## DW_AT_stmt_list
62 .byte 23 ## DW_FORM_sec_offset
63 .byte 27 ## DW_AT_comp_dir
64 .byte 14 ## DW_FORM_strp
65 .ascii "\341\177" ## DW_AT_APPLE_optimized
66 .byte 25 ## DW_FORM_flag_present
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
73 .byte 2 ## Abbreviation Code
74 .byte 52 ## DW_TAG_variable
75 .byte 0 ## DW_CHILDREN_no
77 .byte 14 ## DW_FORM_strp
78 .byte 73 ## DW_AT_type
79 .byte 19 ## DW_FORM_ref4
80 .byte 63 ## DW_AT_external
81 .byte 25 ## DW_FORM_flag_present
82 .byte 58 ## DW_AT_decl_file
83 .byte 11 ## DW_FORM_data1
84 .byte 59 ## DW_AT_decl_line
85 .byte 11 ## DW_FORM_data1
86 .byte 2 ## DW_AT_location
87 .byte 24 ## DW_FORM_exprloc
90 .byte 3 ## Abbreviation Code
91 .byte 53 ## DW_TAG_volatile_type
92 .byte 0 ## DW_CHILDREN_no
93 .byte 73 ## DW_AT_type
94 .byte 19 ## DW_FORM_ref4
97 .byte 4 ## Abbreviation Code
98 .byte 36 ## DW_TAG_base_type
99 .byte 0 ## DW_CHILDREN_no
100 .byte 3 ## DW_AT_name
101 .byte 14 ## DW_FORM_strp
102 .byte 62 ## DW_AT_encoding
103 .byte 11 ## DW_FORM_data1
104 .byte 11 ## DW_AT_byte_size
105 .byte 11 ## DW_FORM_data1
108 .byte 5 ## Abbreviation Code
109 .byte 46 ## DW_TAG_subprogram
110 .byte 1 ## DW_CHILDREN_yes
111 .byte 17 ## DW_AT_low_pc
112 .byte 1 ## DW_FORM_addr
113 .byte 18 ## DW_AT_high_pc
114 .byte 6 ## DW_FORM_data4
115 .byte 64 ## DW_AT_frame_base
116 .byte 24 ## DW_FORM_exprloc
117 .byte 122 ## DW_AT_call_all_calls
118 .byte 25 ## DW_FORM_flag_present
119 .byte 3 ## DW_AT_name
120 .byte 14 ## DW_FORM_strp
121 .byte 58 ## DW_AT_decl_file
122 .byte 11 ## DW_FORM_data1
123 .byte 59 ## DW_AT_decl_line
124 .byte 11 ## DW_FORM_data1
125 .byte 73 ## DW_AT_type
126 .byte 19 ## DW_FORM_ref4
127 .byte 63 ## DW_AT_external
128 .byte 25 ## DW_FORM_flag_present
129 .ascii "\341\177" ## DW_AT_APPLE_optimized
130 .byte 25 ## DW_FORM_flag_present
133 .byte 6 ## Abbreviation Code
134 .byte 11 ## DW_TAG_lexical_block
135 .byte 1 ## DW_CHILDREN_yes
136 .byte 17 ## DW_AT_low_pc
137 .byte 1 ## DW_FORM_addr
138 .byte 18 ## DW_AT_high_pc
139 .byte 6 ## DW_FORM_data4
142 .byte 7 ## Abbreviation Code
143 .byte 52 ## DW_TAG_variable
144 .byte 0 ## DW_CHILDREN_no
145 .byte 28 ## DW_AT_const_value
146 .byte 13 ## DW_FORM_sdata
147 .byte 3 ## DW_AT_name
148 .byte 14 ## DW_FORM_strp
149 .byte 58 ## DW_AT_decl_file
150 .byte 11 ## DW_FORM_data1
151 .byte 59 ## DW_AT_decl_line
152 .byte 11 ## DW_FORM_data1
153 .byte 73 ## DW_AT_type
154 .byte 19 ## DW_FORM_ref4
158 .section __DWARF,__debug_info,regular,debug
161 .set Lset0, Ldebug_info_end0-Ldebug_info_start0 ## Length of Unit
164 .short 4 ## DWARF version number
165 .set Lset1, Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section
167 .byte 8 ## Address Size (in bytes)
168 .byte 1 ## Abbrev [1] 0xb:0x79 DW_TAG_compile_unit
169 .long 0 ## DW_AT_producer
170 .short 12 ## DW_AT_language
171 .long 101 ## DW_AT_name
172 .long 105 ## DW_AT_LLVM_sysroot
173 .set Lset2, Lline_table_start0-Lsection_line ## DW_AT_stmt_list
175 .long 107 ## DW_AT_comp_dir
176 ## DW_AT_APPLE_optimized
177 .quad Lfunc_begin0 ## DW_AT_low_pc
178 .set Lset3, Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc
180 .byte 2 ## Abbrev [2] 0x2e:0x15 DW_TAG_variable
181 .long 136 ## DW_AT_name
182 .long 67 ## DW_AT_type
184 .byte 1 ## DW_AT_decl_file
185 .byte 1 ## DW_AT_decl_line
186 .byte 9 ## DW_AT_location
189 .byte 3 ## Abbrev [3] 0x43:0x5 DW_TAG_volatile_type
190 .long 72 ## DW_AT_type
191 .byte 4 ## Abbrev [4] 0x48:0x7 DW_TAG_base_type
192 .long 138 ## DW_AT_name
193 .byte 5 ## DW_AT_encoding
194 .byte 4 ## DW_AT_byte_size
195 .byte 5 ## Abbrev [5] 0x4f:0x34 DW_TAG_subprogram
196 .quad Lfunc_begin0 ## DW_AT_low_pc
197 .set Lset4, Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc
199 .byte 1 ## DW_AT_frame_base
201 ## DW_AT_call_all_calls
202 .long 142 ## DW_AT_name
203 .byte 1 ## DW_AT_decl_file
204 .byte 2 ## DW_AT_decl_line
205 .long 72 ## DW_AT_type
207 ## DW_AT_APPLE_optimized
208 .byte 6 ## Abbrev [6] 0x68:0x1a DW_TAG_lexical_block
209 .quad Ltmp0 ## DW_AT_low_pc
210 .set Lset5, Ltmp1-Ltmp0 ## DW_AT_high_pc
212 .byte 7 ## Abbrev [7] 0x75:0xc DW_TAG_variable
213 .byte 3 ## DW_AT_const_value
214 .long 147 ## DW_AT_name
215 .byte 1 ## DW_AT_decl_file
216 .byte 4 ## DW_AT_decl_line
217 .long 72 ## DW_AT_type
218 .byte 0 ## End Of Children Mark
219 .byte 0 ## End Of Children Mark
220 .byte 0 ## End Of Children Mark
222 .section __DWARF,__debug_str,regular,debug
224 .asciz "clang version 11.0.0 (https://github.com/llvm/llvm-project f30ebf437851d3c68fd0eee82afbc0cef7373c00)" ## string offset=0
225 .asciz "a.c" ## string offset=101
226 .asciz "/" ## string offset=105
227 .asciz "/Users/davide/work/build/bin" ## string offset=107
228 .asciz "a" ## string offset=136
229 .asciz "int" ## string offset=138
230 .asciz "main" ## string offset=142
231 .asciz "b" ## string offset=147
232 .section __DWARF,__apple_names,regular,debug
234 .long 1212240712 ## Header Magic
235 .short 1 ## Header Version
236 .short 0 ## Header Hash Function
237 .long 2 ## Header Bucket Count
238 .long 2 ## Header Hash Count
239 .long 12 ## Header Data Length
240 .long 0 ## HeaderData Die Offset Base
241 .long 1 ## HeaderData Atom Count
242 .short 1 ## DW_ATOM_die_offset
243 .short 6 ## DW_FORM_data4
246 .long 177670 ## Hash in Bucket 0
247 .long 2090499946 ## Hash in Bucket 0
248 .set Lset6, LNames0-Lnames_begin ## Offset in Bucket 0
250 .set Lset7, LNames1-Lnames_begin ## Offset in Bucket 0
262 .section __DWARF,__apple_objc,regular,debug
264 .long 1212240712 ## Header Magic
265 .short 1 ## Header Version
266 .short 0 ## Header Hash Function
267 .long 1 ## Header Bucket Count
268 .long 0 ## Header Hash Count
269 .long 12 ## Header Data Length
270 .long 0 ## HeaderData Die Offset Base
271 .long 1 ## HeaderData Atom Count
272 .short 1 ## DW_ATOM_die_offset
273 .short 6 ## DW_FORM_data4
275 .section __DWARF,__apple_namespac,regular,debug
277 .long 1212240712 ## Header Magic
278 .short 1 ## Header Version
279 .short 0 ## Header Hash Function
280 .long 1 ## Header Bucket Count
281 .long 0 ## Header Hash Count
282 .long 12 ## Header Data Length
283 .long 0 ## HeaderData Die Offset Base
284 .long 1 ## HeaderData Atom Count
285 .short 1 ## DW_ATOM_die_offset
286 .short 6 ## DW_FORM_data4
288 .section __DWARF,__apple_types,regular,debug
290 .long 1212240712 ## Header Magic
291 .short 1 ## Header Version
292 .short 0 ## Header Hash Function
293 .long 1 ## Header Bucket Count
294 .long 1 ## Header Hash Count
295 .long 20 ## Header Data Length
296 .long 0 ## HeaderData Die Offset Base
297 .long 3 ## HeaderData Atom Count
298 .short 1 ## DW_ATOM_die_offset
299 .short 6 ## DW_FORM_data4
300 .short 3 ## DW_ATOM_die_tag
301 .short 5 ## DW_FORM_data2
302 .short 4 ## DW_ATOM_type_flags
303 .short 11 ## DW_FORM_data1
305 .long 193495088 ## Hash in Bucket 0
306 .set Lset8, Ltypes0-Ltypes_begin ## Offset in Bucket 0
315 .subsections_via_symbols
316 .section __DWARF,__debug_line,regular,debug