1 ## Use llvm-dwarfdump to check the integrity of the inlined function "bar"
2 ## DWARF range after llvm-bolt removes a 6-byte nop instruction.
4 ## If the range is not properly updated, it will exceed the range of the
5 ## containing function causing llvm-dwarfdump to issue an error.
7 # CHECK-NOT: error: DIE address ranges are not contained in its parent's ranges
9 # REQUIRES: system-linux
11 # RUN: %clang++ %cflags -gdwarf-4 %s -o %t.exe -Wl,-q
12 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
13 # RUN: llvm-dwarfdump --verify %t.bolt | FileCheck %s
16 # Test compiled with "-O2 -g" from:
18 # unsigned long bar(unsigned long i) {
19 # asm volatile("nopw %cs:(%rax,%rax)");
23 # int main(int argc, char **argv) {
29 .file "dwarf-inline-range.cpp"
30 .globl _Z3barm # -- Begin function _Z3barm
32 .type _Z3barm,@function
35 .file 1 "." "dwarf-inline-range.cpp"
36 .loc 1 1 0 # dwarf-inline-range.cpp:1:0
39 #DEBUG_VALUE: bar:i <- $rdi
40 .loc 1 2 3 prologue_end # dwarf-inline-range.cpp:2:3
44 .loc 1 3 10 # dwarf-inline-range.cpp:3:10
47 #DEBUG_VALUE: bar:i <- $rax
48 .loc 1 3 3 is_stmt 0 # dwarf-inline-range.cpp:3:3
52 .size _Z3barm, .Lfunc_end0-_Z3barm
55 .globl main # -- Begin function main
60 .loc 1 6 0 is_stmt 1 # dwarf-inline-range.cpp:6:0
63 #DEBUG_VALUE: main:argc <- $edi
64 #DEBUG_VALUE: main:argv <- $rsi
65 #DEBUG_VALUE: bar:i <- [DW_OP_LLVM_convert 32 5, DW_OP_LLVM_convert 64 5, DW_OP_stack_value] $edi
66 .loc 1 2 3 prologue_end # dwarf-inline-range.cpp:2:3
71 #DEBUG_VALUE: bar:i <- [DW_OP_LLVM_convert 32 5, DW_OP_LLVM_convert 64 5, DW_OP_plus_uconst 1, DW_OP_stack_value] undef
72 .loc 1 8 3 # dwarf-inline-range.cpp:8:3
77 .size main, .Lfunc_end1-main
80 .section .debug_loc,"",@progbits
82 .quad .Lfunc_begin0-.Lfunc_begin0
83 .quad .Ltmp0-.Lfunc_begin0
84 .short 1 # Loc expr size
86 .quad .Ltmp0-.Lfunc_begin0
87 .quad .Lfunc_end0-.Lfunc_begin0
88 .short 1 # Loc expr size
93 .quad .Lfunc_begin1-.Lfunc_begin0
94 .quad .Ltmp2-.Lfunc_begin0
95 .short 21 # Loc expr size
96 .byte 117 # DW_OP_breg5
98 .byte 16 # DW_OP_constu
99 .byte 255 # 4294967295
106 .byte 16 # DW_OP_constu
109 .byte 48 # DW_OP_lit0
112 .byte 16 # DW_OP_constu
116 .byte 159 # DW_OP_stack_value
119 .section .debug_abbrev,"",@progbits
120 .byte 1 # Abbreviation Code
121 .byte 17 # DW_TAG_compile_unit
122 .byte 1 # DW_CHILDREN_yes
123 .byte 37 # DW_AT_producer
124 .byte 14 # DW_FORM_strp
125 .byte 19 # DW_AT_language
126 .byte 5 # DW_FORM_data2
128 .byte 14 # DW_FORM_strp
129 .byte 16 # DW_AT_stmt_list
130 .byte 23 # DW_FORM_sec_offset
131 .byte 27 # DW_AT_comp_dir
132 .byte 14 # DW_FORM_strp
133 .byte 17 # DW_AT_low_pc
134 .byte 1 # DW_FORM_addr
135 .byte 18 # DW_AT_high_pc
136 .byte 6 # DW_FORM_data4
139 .byte 2 # Abbreviation Code
140 .byte 46 # DW_TAG_subprogram
141 .byte 1 # DW_CHILDREN_yes
142 .byte 17 # DW_AT_low_pc
143 .byte 1 # DW_FORM_addr
144 .byte 18 # DW_AT_high_pc
145 .byte 6 # DW_FORM_data4
146 .byte 64 # DW_AT_frame_base
147 .byte 24 # DW_FORM_exprloc
148 .ascii "\227B" # DW_AT_GNU_all_call_sites
149 .byte 25 # DW_FORM_flag_present
150 .byte 49 # DW_AT_abstract_origin
151 .byte 19 # DW_FORM_ref4
154 .byte 3 # Abbreviation Code
155 .byte 5 # DW_TAG_formal_parameter
156 .byte 0 # DW_CHILDREN_no
157 .byte 2 # DW_AT_location
158 .byte 23 # DW_FORM_sec_offset
159 .byte 49 # DW_AT_abstract_origin
160 .byte 19 # DW_FORM_ref4
163 .byte 4 # Abbreviation Code
164 .byte 46 # DW_TAG_subprogram
165 .byte 1 # DW_CHILDREN_yes
166 .byte 110 # DW_AT_linkage_name
167 .byte 14 # DW_FORM_strp
169 .byte 14 # DW_FORM_strp
170 .byte 58 # DW_AT_decl_file
171 .byte 11 # DW_FORM_data1
172 .byte 59 # DW_AT_decl_line
173 .byte 11 # DW_FORM_data1
174 .byte 73 # DW_AT_type
175 .byte 19 # DW_FORM_ref4
176 .byte 63 # DW_AT_external
177 .byte 25 # DW_FORM_flag_present
178 .byte 32 # DW_AT_inline
179 .byte 11 # DW_FORM_data1
182 .byte 5 # Abbreviation Code
183 .byte 5 # DW_TAG_formal_parameter
184 .byte 0 # DW_CHILDREN_no
186 .byte 14 # DW_FORM_strp
187 .byte 58 # DW_AT_decl_file
188 .byte 11 # DW_FORM_data1
189 .byte 59 # DW_AT_decl_line
190 .byte 11 # DW_FORM_data1
191 .byte 73 # DW_AT_type
192 .byte 19 # DW_FORM_ref4
195 .byte 6 # Abbreviation Code
196 .byte 36 # DW_TAG_base_type
197 .byte 0 # DW_CHILDREN_no
199 .byte 14 # DW_FORM_strp
200 .byte 62 # DW_AT_encoding
201 .byte 11 # DW_FORM_data1
202 .byte 11 # DW_AT_byte_size
203 .byte 11 # DW_FORM_data1
206 .byte 7 # Abbreviation Code
207 .byte 46 # DW_TAG_subprogram
208 .byte 1 # DW_CHILDREN_yes
209 .byte 17 # DW_AT_low_pc
210 .byte 1 # DW_FORM_addr
211 .byte 18 # DW_AT_high_pc
212 .byte 6 # DW_FORM_data4
213 .byte 64 # DW_AT_frame_base
214 .byte 24 # DW_FORM_exprloc
215 .ascii "\227B" # DW_AT_GNU_all_call_sites
216 .byte 25 # DW_FORM_flag_present
218 .byte 14 # DW_FORM_strp
219 .byte 58 # DW_AT_decl_file
220 .byte 11 # DW_FORM_data1
221 .byte 59 # DW_AT_decl_line
222 .byte 11 # DW_FORM_data1
223 .byte 73 # DW_AT_type
224 .byte 19 # DW_FORM_ref4
225 .byte 63 # DW_AT_external
226 .byte 25 # DW_FORM_flag_present
229 .byte 8 # Abbreviation Code
230 .byte 5 # DW_TAG_formal_parameter
231 .byte 0 # DW_CHILDREN_no
232 .byte 2 # DW_AT_location
233 .byte 24 # DW_FORM_exprloc
235 .byte 14 # DW_FORM_strp
236 .byte 58 # DW_AT_decl_file
237 .byte 11 # DW_FORM_data1
238 .byte 59 # DW_AT_decl_line
239 .byte 11 # DW_FORM_data1
240 .byte 73 # DW_AT_type
241 .byte 19 # DW_FORM_ref4
244 .byte 9 # Abbreviation Code
245 .byte 29 # DW_TAG_inlined_subroutine
246 .byte 1 # DW_CHILDREN_yes
247 .byte 49 # DW_AT_abstract_origin
248 .byte 19 # DW_FORM_ref4
249 .byte 17 # DW_AT_low_pc
250 .byte 1 # DW_FORM_addr
251 .byte 18 # DW_AT_high_pc
252 .byte 6 # DW_FORM_data4
253 .byte 88 # DW_AT_call_file
254 .byte 11 # DW_FORM_data1
255 .byte 89 # DW_AT_call_line
256 .byte 11 # DW_FORM_data1
257 .byte 87 # DW_AT_call_column
258 .byte 11 # DW_FORM_data1
261 .byte 10 # Abbreviation Code
262 .byte 15 # DW_TAG_pointer_type
263 .byte 0 # DW_CHILDREN_no
264 .byte 73 # DW_AT_type
265 .byte 19 # DW_FORM_ref4
269 .section .debug_info,"",@progbits
271 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
273 .short 4 # DWARF version number
274 .long .debug_abbrev # Offset Into Abbrev. Section
275 .byte 8 # Address Size (in bytes)
276 .byte 1 # Abbrev [1] 0xb:0xca DW_TAG_compile_unit
277 .long .Linfo_string0 # DW_AT_producer
278 .short 33 # DW_AT_language
279 .long .Linfo_string1 # DW_AT_name
280 .long .Lline_table_start0 # DW_AT_stmt_list
281 .long .Linfo_string2 # DW_AT_comp_dir
282 .quad .Lfunc_begin0 # DW_AT_low_pc
283 .long .Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc
284 .byte 2 # Abbrev [2] 0x2a:0x1d DW_TAG_subprogram
285 .quad .Lfunc_begin0 # DW_AT_low_pc
286 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
287 .byte 1 # DW_AT_frame_base
289 # DW_AT_GNU_all_call_sites
290 .long 71 # DW_AT_abstract_origin
291 .byte 3 # Abbrev [3] 0x3d:0x9 DW_TAG_formal_parameter
292 .long .Ldebug_loc0 # DW_AT_location
293 .long 87 # DW_AT_abstract_origin
294 .byte 0 # End Of Children Mark
295 .byte 4 # Abbrev [4] 0x47:0x1c DW_TAG_subprogram
296 .long .Linfo_string3 # DW_AT_linkage_name
297 .long .Linfo_string4 # DW_AT_name
298 .byte 1 # DW_AT_decl_file
299 .byte 1 # DW_AT_decl_line
300 .long 99 # DW_AT_type
302 .byte 1 # DW_AT_inline
303 .byte 5 # Abbrev [5] 0x57:0xb DW_TAG_formal_parameter
304 .long .Linfo_string6 # DW_AT_name
305 .byte 1 # DW_AT_decl_file
306 .byte 1 # DW_AT_decl_line
307 .long 99 # DW_AT_type
308 .byte 0 # End Of Children Mark
309 .byte 6 # Abbrev [6] 0x63:0x7 DW_TAG_base_type
310 .long .Linfo_string5 # DW_AT_name
311 .byte 7 # DW_AT_encoding
312 .byte 8 # DW_AT_byte_size
313 .byte 7 # Abbrev [7] 0x6a:0x52 DW_TAG_subprogram
314 .quad .Lfunc_begin1 # DW_AT_low_pc
315 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
316 .byte 1 # DW_AT_frame_base
318 # DW_AT_GNU_all_call_sites
319 .long .Linfo_string7 # DW_AT_name
320 .byte 1 # DW_AT_decl_file
321 .byte 6 # DW_AT_decl_line
322 .long 188 # DW_AT_type
324 .byte 8 # Abbrev [8] 0x83:0xd DW_TAG_formal_parameter
325 .byte 1 # DW_AT_location
327 .long .Linfo_string9 # DW_AT_name
328 .byte 1 # DW_AT_decl_file
329 .byte 6 # DW_AT_decl_line
330 .long 188 # DW_AT_type
331 .byte 8 # Abbrev [8] 0x90:0xd DW_TAG_formal_parameter
332 .byte 1 # DW_AT_location
334 .long .Linfo_string10 # DW_AT_name
335 .byte 1 # DW_AT_decl_file
336 .byte 6 # DW_AT_decl_line
337 .long 195 # DW_AT_type
338 .byte 9 # Abbrev [9] 0x9d:0x1e DW_TAG_inlined_subroutine
339 .long 71 # DW_AT_abstract_origin
340 .quad .Lfunc_begin1 # DW_AT_low_pc
341 .long .Ltmp2-.Lfunc_begin1 # DW_AT_high_pc
342 .byte 1 # DW_AT_call_file
343 .byte 7 # DW_AT_call_line
344 .byte 3 # DW_AT_call_column
345 .byte 3 # Abbrev [3] 0xb1:0x9 DW_TAG_formal_parameter
346 .long .Ldebug_loc1 # DW_AT_location
347 .long 87 # DW_AT_abstract_origin
348 .byte 0 # End Of Children Mark
349 .byte 0 # End Of Children Mark
350 .byte 6 # Abbrev [6] 0xbc:0x7 DW_TAG_base_type
351 .long .Linfo_string8 # DW_AT_name
352 .byte 5 # DW_AT_encoding
353 .byte 4 # DW_AT_byte_size
354 .byte 10 # Abbrev [10] 0xc3:0x5 DW_TAG_pointer_type
355 .long 200 # DW_AT_type
356 .byte 10 # Abbrev [10] 0xc8:0x5 DW_TAG_pointer_type
357 .long 205 # DW_AT_type
358 .byte 6 # Abbrev [6] 0xcd:0x7 DW_TAG_base_type
359 .long .Linfo_string11 # DW_AT_name
360 .byte 6 # DW_AT_encoding
361 .byte 1 # DW_AT_byte_size
362 .byte 0 # End Of Children Mark
364 .section .debug_str,"MS",@progbits,1
366 .asciz "clang version 15"
368 .asciz "dwarf-inline-range.cpp" # string offset=69
370 .asciz "." # string offset=92
372 .asciz "_Z3barm" # string offset=112
374 .asciz "bar" # string offset=120
376 .asciz "unsigned long" # string offset=124
378 .asciz "i" # string offset=138
380 .asciz "main" # string offset=140
382 .asciz "int" # string offset=145
384 .asciz "argc" # string offset=149
386 .asciz "argv" # string offset=154
388 .asciz "char" # string offset=159
389 .ident "clang version 15"
390 .section ".note.GNU-stack","",@progbits
392 .section .debug_line,"",@progbits