Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / Shell / SymbolFile / DWARF / range-lower-then-low-pc.s
blobe3cc84db126527f687bdf379b9234839fd79b35c
1 # REQUIRES: x86
3 # RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
4 # RUN: lldb-test symbols %t &> %t.txt
5 # RUN: cat %t.txt | FileCheck %s
7 # Tests that error is printed correctly when DW_AT_low_pc value is
8 # greater then a range entry.
10 # CHECK: 0x0000006e: adding range [0x0000000000000000-0x000000000000001f)
11 # CHECK-SAME: which has a base that is less than the function's low PC 0x0000000000000021.
12 # CHECK-SAME: Please file a bug and attach the file at the start of this error message
16 # Test was manually modified to change DW_TAG_lexical_block
17 # to use DW_AT_ranges, and value lower then DW_AT_low_pc value
18 # in DW_TAG_subprogram
19 # static int foo(bool b) {
20 # if (b) {
21 # int food = 1;
22 # return food;
23 # }
24 # return 0;
25 # }
26 # int main() {
27 # return foo(true);
28 # }
29 .text
30 .file "main.cpp"
31 .section .text.main,"ax",@progbits
32 .globl main # -- Begin function main
33 .p2align 4, 0x90
34 .type main,@function
35 main: # @main
36 .Lfunc_begin0:
37 .file 1 "base-lower-then-range-entry" "main.cpp"
38 .loc 1 8 0 # main.cpp:8:0
39 .cfi_startproc
40 # %bb.0: # %entry
41 pushq %rbp
42 .cfi_def_cfa_offset 16
43 .cfi_offset %rbp, -16
44 movq %rsp, %rbp
45 .cfi_def_cfa_register %rbp
46 subq $16, %rsp
47 movl $0, -4(%rbp)
48 .Ltmp0:
49 .loc 1 9 10 prologue_end # main.cpp:9:10
50 movl $1, %edi
51 callq _ZL3foob
52 .loc 1 9 3 epilogue_begin is_stmt 0 # main.cpp:9:3
53 addq $16, %rsp
54 popq %rbp
55 .cfi_def_cfa %rsp, 8
56 retq
57 .Ltmp1:
58 .Lfunc_end0:
59 .size main, .Lfunc_end0-main
60 .cfi_endproc
61 # -- End function
62 .section .text._ZL3foob,"ax",@progbits
63 .p2align 4, 0x90 # -- Begin function _ZL3foob
64 .type _ZL3foob,@function
65 _ZL3foob: # @_ZL3foob
66 .Lfunc_begin1:
67 .loc 1 1 0 is_stmt 1 # main.cpp:1:0
68 .cfi_startproc
69 # %bb.0: # %entry
70 pushq %rbp
71 .cfi_def_cfa_offset 16
72 .cfi_offset %rbp, -16
73 movq %rsp, %rbp
74 .cfi_def_cfa_register %rbp
75 movb %dil, %al
76 andb $1, %al
77 movb %al, -5(%rbp)
78 .Ltmp2:
79 .loc 1 2 7 prologue_end # main.cpp:2:7
80 testb $1, -5(%rbp)
81 je .LBB1_2
82 # %bb.1: # %if.then
83 .Ltmp3:
84 .loc 1 3 8 # main.cpp:3:8
85 movl $1, -12(%rbp)
86 .loc 1 4 12 # main.cpp:4:12
87 movl -12(%rbp), %eax
88 .loc 1 4 5 is_stmt 0 # main.cpp:4:5
89 movl %eax, -4(%rbp)
90 jmp .LBB1_3
91 .Ltmp4:
92 .LBB1_2: # %if.end
93 .loc 1 6 3 is_stmt 1 # main.cpp:6:3
94 movl $0, -4(%rbp)
95 .LBB1_3: # %return
96 .loc 1 7 1 # main.cpp:7:1
97 movl -4(%rbp), %eax
98 .loc 1 7 1 epilogue_begin is_stmt 0 # main.cpp:7:1
99 popq %rbp
100 .cfi_def_cfa %rsp, 8
101 retq
102 .Ltmp5:
103 .Lfunc_end1:
104 .size _ZL3foob, .Lfunc_end1-_ZL3foob
105 .cfi_endproc
106 # -- End function
107 .section .debug_abbrev,"",@progbits
108 .byte 1 # Abbreviation Code
109 .byte 17 # DW_TAG_compile_unit
110 .byte 1 # DW_CHILDREN_yes
111 .byte 37 # DW_AT_producer
112 .byte 14 # DW_FORM_strp
113 .byte 19 # DW_AT_language
114 .byte 5 # DW_FORM_data2
115 .byte 3 # DW_AT_name
116 .byte 14 # DW_FORM_strp
117 .byte 16 # DW_AT_stmt_list
118 .byte 23 # DW_FORM_sec_offset
119 .byte 27 # DW_AT_comp_dir
120 .byte 14 # DW_FORM_strp
121 .byte 17 # DW_AT_low_pc
122 .byte 1 # DW_FORM_addr
123 .byte 85 # DW_AT_ranges
124 .byte 23 # DW_FORM_sec_offset
125 .byte 0 # EOM(1)
126 .byte 0 # EOM(2)
127 .byte 2 # Abbreviation Code
128 .byte 46 # DW_TAG_subprogram
129 .byte 0 # DW_CHILDREN_no
130 .byte 17 # DW_AT_low_pc
131 .byte 1 # DW_FORM_addr
132 .byte 18 # DW_AT_high_pc
133 .byte 6 # DW_FORM_data4
134 .byte 64 # DW_AT_frame_base
135 .byte 24 # DW_FORM_exprloc
136 .byte 3 # DW_AT_name
137 .byte 14 # DW_FORM_strp
138 .byte 58 # DW_AT_decl_file
139 .byte 11 # DW_FORM_data1
140 .byte 59 # DW_AT_decl_line
141 .byte 11 # DW_FORM_data1
142 .byte 73 # DW_AT_type
143 .byte 19 # DW_FORM_ref4
144 .byte 63 # DW_AT_external
145 .byte 25 # DW_FORM_flag_present
146 .byte 0 # EOM(1)
147 .byte 0 # EOM(2)
148 .byte 3 # Abbreviation Code
149 .byte 46 # DW_TAG_subprogram
150 .byte 1 # DW_CHILDREN_yes
151 .byte 17 # DW_AT_low_pc
152 .byte 1 # DW_FORM_addr
153 .byte 18 # DW_AT_high_pc
154 .byte 6 # DW_FORM_data4
155 .byte 64 # DW_AT_frame_base
156 .byte 24 # DW_FORM_exprloc
157 .byte 110 # DW_AT_linkage_name
158 .byte 14 # DW_FORM_strp
159 .byte 3 # DW_AT_name
160 .byte 14 # DW_FORM_strp
161 .byte 58 # DW_AT_decl_file
162 .byte 11 # DW_FORM_data1
163 .byte 59 # DW_AT_decl_line
164 .byte 11 # DW_FORM_data1
165 .byte 73 # DW_AT_type
166 .byte 19 # DW_FORM_ref4
167 .byte 0 # EOM(1)
168 .byte 0 # EOM(2)
169 .byte 4 # Abbreviation Code
170 .byte 5 # DW_TAG_formal_parameter
171 .byte 0 # DW_CHILDREN_no
172 .byte 2 # DW_AT_location
173 .byte 24 # DW_FORM_exprloc
174 .byte 3 # DW_AT_name
175 .byte 14 # DW_FORM_strp
176 .byte 58 # DW_AT_decl_file
177 .byte 11 # DW_FORM_data1
178 .byte 59 # DW_AT_decl_line
179 .byte 11 # DW_FORM_data1
180 .byte 73 # DW_AT_type
181 .byte 19 # DW_FORM_ref4
182 .byte 0 # EOM(1)
183 .byte 0 # EOM(2)
184 .byte 5 # Abbreviation Code
185 .byte 11 # DW_TAG_lexical_block
186 .byte 1 # DW_CHILDREN_yes
187 .byte 85 # DW_AT_ranges <------ Manually modified. Replaced low_pc/high)_pc with rangres.
188 .byte 23 # DW_FORM_sec_offset
189 .byte 0 # EOM(1)
190 .byte 0 # EOM(2)
191 .byte 6 # Abbreviation Code
192 .byte 52 # DW_TAG_variable
193 .byte 0 # DW_CHILDREN_no
194 .byte 2 # DW_AT_location
195 .byte 24 # DW_FORM_exprloc
196 .byte 3 # DW_AT_name
197 .byte 14 # DW_FORM_strp
198 .byte 58 # DW_AT_decl_file
199 .byte 11 # DW_FORM_data1
200 .byte 59 # DW_AT_decl_line
201 .byte 11 # DW_FORM_data1
202 .byte 73 # DW_AT_type
203 .byte 19 # DW_FORM_ref4
204 .byte 0 # EOM(1)
205 .byte 0 # EOM(2)
206 .byte 7 # Abbreviation Code
207 .byte 36 # DW_TAG_base_type
208 .byte 0 # DW_CHILDREN_no
209 .byte 3 # DW_AT_name
210 .byte 14 # DW_FORM_strp
211 .byte 62 # DW_AT_encoding
212 .byte 11 # DW_FORM_data1
213 .byte 11 # DW_AT_byte_size
214 .byte 11 # DW_FORM_data1
215 .byte 0 # EOM(1)
216 .byte 0 # EOM(2)
217 .byte 0 # EOM(3)
218 .section .debug_info,"",@progbits
219 .Lcu_begin0:
220 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
221 .Ldebug_info_start0:
222 .short 4 # DWARF version number
223 .long .debug_abbrev # Offset Into Abbrev. Section
224 .byte 8 # Address Size (in bytes)
225 .byte 1 # Abbrev [1] 0xb:0x8f DW_TAG_compile_unit
226 .long .Linfo_string0 # DW_AT_producer
227 .short 33 # DW_AT_language
228 .long .Linfo_string1 # DW_AT_name
229 .long .Lline_table_start0 # DW_AT_stmt_list
230 .long .Linfo_string2 # DW_AT_comp_dir
231 .quad 0 # DW_AT_low_pc
232 .long .Ldebug_ranges0 # DW_AT_ranges
233 .byte 2 # Abbrev [2] 0x2a:0x19 DW_TAG_subprogram
234 .quad .Lfunc_begin0 # DW_AT_low_pc
235 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
236 .byte 1 # DW_AT_frame_base
237 .byte 86
238 .long .Linfo_string3 # DW_AT_name
239 .byte 1 # DW_AT_decl_file
240 .byte 8 # DW_AT_decl_line
241 .long 138 # DW_AT_type
242 # DW_AT_external
243 .byte 3 # Abbrev [3] 0x43:0x48 DW_TAG_subprogram
244 .quad .Lfunc_begin1 + 1 # DW_AT_low_pc
245 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
246 .byte 1 # DW_AT_frame_base
247 .byte 86
248 .long .Linfo_string5 # DW_AT_linkage_name
249 .long .Linfo_string6 # DW_AT_name
250 .byte 1 # DW_AT_decl_file
251 .byte 1 # DW_AT_decl_line
252 .long 138 # DW_AT_type
253 .byte 4 # Abbrev [4] 0x60:0xe DW_TAG_formal_parameter
254 .byte 2 # DW_AT_location
255 .byte 145
256 .byte 123
257 .long .Linfo_string7 # DW_AT_name
258 .byte 1 # DW_AT_decl_file
259 .byte 1 # DW_AT_decl_line
260 .long 138 # DW_AT_type
261 .byte 5 # Abbrev [5] 0x6e:0x1c DW_TAG_lexical_block
262 .long .Ldebug_ranges0 # DW_AT_ranges <-- Manually modified replaced low_pc/high_pc to rangres.
263 .byte 6 # Abbrev [6] 0x7b:0xe DW_TAG_variable
264 .byte 2 # DW_AT_location
265 .byte 145
266 .byte 116
267 .long .Linfo_string9 # DW_AT_name
268 .byte 1 # DW_AT_decl_file
269 .byte 3 # DW_AT_decl_line
270 .long 138 # DW_AT_type
271 .byte 0 # End Of Children Mark
272 .byte 0 # End Of Children Mark
273 .byte 7 # Abbrev [7] 0x8b:0x7 DW_TAG_base_type
274 .long .Linfo_string4 # DW_AT_name
275 .byte 5 # DW_AT_encoding
276 .byte 4 # DW_AT_byte_size
277 .byte 7 # Abbrev [7] 0x92:0x7 DW_TAG_base_type
278 .long .Linfo_string8 # DW_AT_name
279 .byte 2 # DW_AT_encoding
280 .byte 1 # DW_AT_byte_size
281 .byte 0 # End Of Children Mark
282 .Ldebug_info_end0:
283 .section .debug_ranges,"",@progbits
284 .Ldebug_ranges0:
285 .quad .Lfunc_begin0
286 .quad .Lfunc_end0
287 .quad .Lfunc_begin1
288 .quad .Lfunc_end1
289 .quad 0
290 .quad 0
291 .section .debug_str,"MS",@progbits,1
292 .Linfo_string0:
293 .asciz "clang version 17.0.0 (https://github.com/llvm/llvm-project.git 73027ae39b1492e5b6033358a13b86d7d1e781ae)" # string offset=0
294 .Linfo_string1:
295 .asciz "main.cpp" # string offset=105
296 .Linfo_string2:
297 .asciz "base-lower-then-range-entry" # string offset=114
298 .Linfo_string3:
299 .asciz "main" # string offset=179
300 .Linfo_string4:
301 .asciz "int" # string offset=184
302 .Linfo_string5:
303 .asciz "_ZL3foob" # string offset=188
304 .Linfo_string6:
305 .asciz "foo" # string offset=197
306 .Linfo_string7:
307 .asciz "b" # string offset=201
308 .Linfo_string8:
309 .asciz "bool" # string offset=203
310 .Linfo_string9:
311 .asciz "food" # string offset=208
312 .ident "clang version 17.0.0 (https://github.com/llvm/llvm-project.git 73027ae39b1492e5b6033358a13b86d7d1e781ae)"
313 .section ".note.GNU-stack","",@progbits
314 .addrsig
315 .addrsig_sym _ZL3foob
316 .section .debug_line,"",@progbits
317 .Lline_table_start0: