1 # REQUIRES: system-linux
3 # RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o
4 # RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q
5 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
6 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
7 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=CHECK %s
9 # PRECHECK: DW_TAG_variable
10 # PRECHECK: DW_AT_name [DW_FORM_strx1]
11 # PRECHECK: DW_AT_type [DW_FORM_ref4]
12 # PRECHECK: DW_AT_decl_file [DW_FORM_data1]
13 # PRECHECK: DW_AT_decl_line [DW_FORM_data1]
14 # PRECHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_piece 0x4, DW_OP_addrx 0x1, DW_OP_piece 0x4)
17 # CHECK: DW_TAG_variable
18 # CHECK: DW_AT_name [DW_FORM_strx1]
19 # CHECK: DW_AT_type [DW_FORM_ref4]
20 # CHECK: DW_AT_decl_file [DW_FORM_data1]
21 # CHECK: DW_AT_decl_line [DW_FORM_data1]
22 # CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x2, DW_OP_piece 0x4, DW_OP_addrx 0x3, DW_OP_piece 0x4)
24 # This test checks that we update DW_AT_location [DW_FORM_exprloc] with multiple DW_OP_addrx.
26 # struct pair {int i; int j; };
31 # void store(int i, int j) {
40 .file 0 "task" "main.cpp" md5 0x02662c1bdb2472436fee6b36e4dca0e0
41 .globl _Z4loadv # -- Begin function _Z4loadv
43 .type _Z4loadv,@function
46 .loc 0 3 0 # main.cpp:3:0
49 .loc 0 4 20 prologue_end # main.cpp:4:20
50 movl _ZL1p.1
(%rip
), %eax
51 .loc 0 4 16 is_stmt 0 # main.cpp:4:16
52 addl _ZL1p.0
(%rip
), %eax
53 .loc 0 4 5 # main.cpp:4:5
57 .size _Z4loadv, .Lfunc_end0-_Z4loadv
60 .globl _Z5storeii # -- Begin function _Z5storeii
62 .type _Z5storeii,@function
63 _Z5storeii
: # @_Z5storeii
65 .loc 0 6 0 is_stmt 1 # main.cpp:6:0
68 #DEBUG_VALUE: store:i <- $edi
69 #DEBUG_VALUE: store:j <- $esi
70 .loc 0 7 9 prologue_end # main.cpp:7:9
71 movl
%edi
, _ZL1p.0
(%rip
)
72 .loc 0 8 11 # main.cpp:8:11
73 movl
%esi
, _ZL1p.1
(%rip
)
74 .loc 0 9 1 # main.cpp:9:1
78 .size _Z5storeii, .Lfunc_end1-_Z5storeii
81 .globl main # -- Begin function main
86 .loc 0 10 0 # main.cpp:10:0
89 .loc 0 11 1 prologue_end # main.cpp:11:1
94 .size main, .Lfunc_end2-main
97 .type _ZL1p.0,@object # @_ZL1p.0
100 .type _ZL1p.1,@object # @_ZL1p.1
103 .section .debug_abbrev,"",@progbits
104 .byte 1 # Abbreviation Code
105 .byte 17 # DW_TAG_compile_unit
106 .byte 1 # DW_CHILDREN_yes
107 .byte 37 # DW_AT_producer
108 .byte 37 # DW_FORM_strx1
109 .byte 19 # DW_AT_language
110 .byte 5 # DW_FORM_data2
112 .byte 37 # DW_FORM_strx1
113 .byte 114 # DW_AT_str_offsets_base
114 .byte 23 # DW_FORM_sec_offset
115 .byte 16 # DW_AT_stmt_list
116 .byte 23 # DW_FORM_sec_offset
117 .byte 27 # DW_AT_comp_dir
118 .byte 37 # DW_FORM_strx1
119 .byte 17 # DW_AT_low_pc
120 .byte 27 # DW_FORM_addrx
121 .byte 18 # DW_AT_high_pc
122 .byte 6 # DW_FORM_data4
123 .byte 115 # DW_AT_addr_base
124 .byte 23 # DW_FORM_sec_offset
127 .byte 2 # Abbreviation Code
128 .byte 52 # DW_TAG_variable
129 .byte 0 # DW_CHILDREN_no
131 .byte 37 # DW_FORM_strx1
132 .byte 73 # DW_AT_type
133 .byte 19 # DW_FORM_ref4
134 .byte 58 # DW_AT_decl_file
135 .byte 11 # DW_FORM_data1
136 .byte 59 # DW_AT_decl_line
137 .byte 11 # DW_FORM_data1
138 .byte 2 # DW_AT_location
139 .byte 24 # DW_FORM_exprloc
140 .byte 110 # DW_AT_linkage_name
141 .byte 37 # DW_FORM_strx1
144 .byte 3 # Abbreviation Code
145 .byte 19 # DW_TAG_structure_type
146 .byte 1 # DW_CHILDREN_yes
147 .byte 54 # DW_AT_calling_convention
148 .byte 11 # DW_FORM_data1
150 .byte 37 # DW_FORM_strx1
151 .byte 11 # DW_AT_byte_size
152 .byte 11 # DW_FORM_data1
153 .byte 58 # DW_AT_decl_file
154 .byte 11 # DW_FORM_data1
155 .byte 59 # DW_AT_decl_line
156 .byte 11 # DW_FORM_data1
159 .byte 4 # Abbreviation Code
160 .byte 13 # DW_TAG_member
161 .byte 0 # DW_CHILDREN_no
163 .byte 37 # DW_FORM_strx1
164 .byte 73 # DW_AT_type
165 .byte 19 # DW_FORM_ref4
166 .byte 58 # DW_AT_decl_file
167 .byte 11 # DW_FORM_data1
168 .byte 59 # DW_AT_decl_line
169 .byte 11 # DW_FORM_data1
170 .byte 56 # DW_AT_data_member_location
171 .byte 11 # DW_FORM_data1
174 .byte 5 # Abbreviation Code
175 .byte 36 # DW_TAG_base_type
176 .byte 0 # DW_CHILDREN_no
178 .byte 37 # DW_FORM_strx1
179 .byte 62 # DW_AT_encoding
180 .byte 11 # DW_FORM_data1
181 .byte 11 # DW_AT_byte_size
182 .byte 11 # DW_FORM_data1
185 .byte 6 # Abbreviation Code
186 .byte 46 # DW_TAG_subprogram
187 .byte 0 # DW_CHILDREN_no
188 .byte 17 # DW_AT_low_pc
189 .byte 27 # DW_FORM_addrx
190 .byte 18 # DW_AT_high_pc
191 .byte 6 # DW_FORM_data4
192 .byte 64 # DW_AT_frame_base
193 .byte 24 # DW_FORM_exprloc
194 .byte 122 # DW_AT_call_all_calls
195 .byte 25 # DW_FORM_flag_present
196 .byte 110 # DW_AT_linkage_name
197 .byte 37 # DW_FORM_strx1
199 .byte 37 # DW_FORM_strx1
200 .byte 58 # DW_AT_decl_file
201 .byte 11 # DW_FORM_data1
202 .byte 59 # DW_AT_decl_line
203 .byte 11 # DW_FORM_data1
204 .byte 73 # DW_AT_type
205 .byte 19 # DW_FORM_ref4
206 .byte 63 # DW_AT_external
207 .byte 25 # DW_FORM_flag_present
210 .byte 7 # Abbreviation Code
211 .byte 46 # DW_TAG_subprogram
212 .byte 1 # DW_CHILDREN_yes
213 .byte 17 # DW_AT_low_pc
214 .byte 27 # DW_FORM_addrx
215 .byte 18 # DW_AT_high_pc
216 .byte 6 # DW_FORM_data4
217 .byte 64 # DW_AT_frame_base
218 .byte 24 # DW_FORM_exprloc
219 .byte 122 # DW_AT_call_all_calls
220 .byte 25 # DW_FORM_flag_present
221 .byte 110 # DW_AT_linkage_name
222 .byte 37 # DW_FORM_strx1
224 .byte 37 # DW_FORM_strx1
225 .byte 58 # DW_AT_decl_file
226 .byte 11 # DW_FORM_data1
227 .byte 59 # DW_AT_decl_line
228 .byte 11 # DW_FORM_data1
229 .byte 63 # DW_AT_external
230 .byte 25 # DW_FORM_flag_present
233 .byte 8 # Abbreviation Code
234 .byte 5 # DW_TAG_formal_parameter
235 .byte 0 # DW_CHILDREN_no
236 .byte 2 # DW_AT_location
237 .byte 24 # DW_FORM_exprloc
239 .byte 37 # DW_FORM_strx1
240 .byte 58 # DW_AT_decl_file
241 .byte 11 # DW_FORM_data1
242 .byte 59 # DW_AT_decl_line
243 .byte 11 # DW_FORM_data1
244 .byte 73 # DW_AT_type
245 .byte 19 # DW_FORM_ref4
248 .byte 9 # Abbreviation Code
249 .byte 46 # DW_TAG_subprogram
250 .byte 0 # DW_CHILDREN_no
251 .byte 17 # DW_AT_low_pc
252 .byte 27 # DW_FORM_addrx
253 .byte 18 # DW_AT_high_pc
254 .byte 6 # DW_FORM_data4
255 .byte 64 # DW_AT_frame_base
256 .byte 24 # DW_FORM_exprloc
257 .byte 122 # DW_AT_call_all_calls
258 .byte 25 # DW_FORM_flag_present
260 .byte 37 # DW_FORM_strx1
261 .byte 58 # DW_AT_decl_file
262 .byte 11 # DW_FORM_data1
263 .byte 59 # DW_AT_decl_line
264 .byte 11 # DW_FORM_data1
265 .byte 73 # DW_AT_type
266 .byte 19 # DW_FORM_ref4
267 .byte 63 # DW_AT_external
268 .byte 25 # DW_FORM_flag_present
272 .section .debug_info,"",@progbits
274 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
276 .short 5 # DWARF version number
277 .byte 1 # DWARF Unit Type
278 .byte 8 # Address Size (in bytes)
279 .long .debug_abbrev # Offset Into Abbrev. Section
280 .byte 1 # Abbrev [1] 0xc:0x87 DW_TAG_compile_unit
281 .byte 0 # DW_AT_producer
282 .short 33 # DW_AT_language
284 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
285 .long .Lline_table_start0 # DW_AT_stmt_list
286 .byte 2 # DW_AT_comp_dir
287 .byte 2 # DW_AT_low_pc
288 .long .Lfunc_end2-.Lfunc_begin0 # DW_AT_high_pc
289 .long .Laddr_table_base0 # DW_AT_addr_base
290 .byte 2 # Abbrev [2] 0x23:0x12 DW_TAG_variable
292 .long 53 # DW_AT_type
293 .byte 0 # DW_AT_decl_file
294 .byte 2 # DW_AT_decl_line
295 .byte 8 # DW_AT_location
304 .byte 8 # DW_AT_linkage_name
305 .byte 3 # Abbrev [3] 0x35:0x19 DW_TAG_structure_type
306 .byte 5 # DW_AT_calling_convention
308 .byte 8 # DW_AT_byte_size
309 .byte 0 # DW_AT_decl_file
310 .byte 1 # DW_AT_decl_line
311 .byte 4 # Abbrev [4] 0x3b:0x9 DW_TAG_member
313 .long 78 # DW_AT_type
314 .byte 0 # DW_AT_decl_file
315 .byte 1 # DW_AT_decl_line
316 .byte 0 # DW_AT_data_member_location
317 .byte 4 # Abbrev [4] 0x44:0x9 DW_TAG_member
319 .long 78 # DW_AT_type
320 .byte 0 # DW_AT_decl_file
321 .byte 1 # DW_AT_decl_line
322 .byte 4 # DW_AT_data_member_location
323 .byte 0 # End Of Children Mark
324 .byte 5 # Abbrev [5] 0x4e:0x4 DW_TAG_base_type
326 .byte 5 # DW_AT_encoding
327 .byte 4 # DW_AT_byte_size
328 .byte 6 # Abbrev [6] 0x52:0x10 DW_TAG_subprogram
329 .byte 2 # DW_AT_low_pc
330 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
331 .byte 1 # DW_AT_frame_base
333 # DW_AT_call_all_calls
334 .byte 9 # DW_AT_linkage_name
335 .byte 10 # DW_AT_name
336 .byte 0 # DW_AT_decl_file
337 .byte 3 # DW_AT_decl_line
338 .long 78 # DW_AT_type
340 .byte 7 # Abbrev [7] 0x62:0x21 DW_TAG_subprogram
341 .byte 3 # DW_AT_low_pc
342 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
343 .byte 1 # DW_AT_frame_base
345 # DW_AT_call_all_calls
346 .byte 11 # DW_AT_linkage_name
347 .byte 12 # DW_AT_name
348 .byte 0 # DW_AT_decl_file
349 .byte 6 # DW_AT_decl_line
351 .byte 8 # Abbrev [8] 0x6e:0xa DW_TAG_formal_parameter
352 .byte 1 # DW_AT_location
355 .byte 0 # DW_AT_decl_file
356 .byte 6 # DW_AT_decl_line
357 .long 78 # DW_AT_type
358 .byte 8 # Abbrev [8] 0x78:0xa DW_TAG_formal_parameter
359 .byte 1 # DW_AT_location
362 .byte 0 # DW_AT_decl_file
363 .byte 6 # DW_AT_decl_line
364 .long 78 # DW_AT_type
365 .byte 0 # End Of Children Mark
366 .byte 9 # Abbrev [9] 0x83:0xf DW_TAG_subprogram
367 .byte 4 # DW_AT_low_pc
368 .long .Lfunc_end2-.Lfunc_begin2 # DW_AT_high_pc
369 .byte 1 # DW_AT_frame_base
371 # DW_AT_call_all_calls
372 .byte 13 # DW_AT_name
373 .byte 0 # DW_AT_decl_file
374 .byte 10 # DW_AT_decl_line
375 .long 78 # DW_AT_type
377 .byte 0 # End Of Children Mark
379 .section .debug_str_offsets,"",@progbits
380 .long 60 # Length of String Offsets Set
384 .section .debug_str,"MS",@progbits,1
386 .asciz "clang version 15.0.0" # string offset=0
388 .asciz "main.cpp" # string offset=134
390 .asciz "test" # string offset=143
392 .asciz "p" # string offset=181
394 .asciz "i" # string offset=183
396 .asciz "int" # string offset=185
398 .asciz "j" # string offset=189
400 .asciz "pair" # string offset=191
402 .asciz "_ZL1p" # string offset=196
404 .asciz "_Z4loadv" # string offset=202
406 .asciz "load" # string offset=211
408 .asciz "_Z5storeii" # string offset=216
410 .asciz "store" # string offset=227
412 .asciz "main" # string offset=233
413 .section .debug_str_offsets,"",@progbits
424 .long .Linfo_string10
425 .long .Linfo_string11
426 .long .Linfo_string12
427 .long .Linfo_string13
428 .section .debug_addr,"",@progbits
429 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
431 .short 5 # DWARF version number
432 .byte 8 # Address size
433 .byte 0 # Segment selector size
441 .ident "clang version 15.0.0"
442 .section ".note.GNU-stack","",@progbits
444 .section .debug_line,"",@progbits