[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / DebugInfo / X86 / dwarfdump-str-offsets.s
blobf6303f123ad3fd0d4ab3966579a267f230ec4d46
1 # RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
2 # RUN: llvm-dwarfdump -v %t.o 2> %t.err | FileCheck --check-prefix=COMMON --check-prefix=SPLIT %s
3 # RUN: llvm-dwarfdump -verify %t.o | FileCheck --check-prefix=VERIFY %s
4 #
5 # Check that we don't report an error on a non-existent range list table.
6 # RUN: FileCheck -allow-empty --check-prefix ERR %s < %t.err
8 # Test object to verify dwarfdump handles v5 string offset tables.
9 # We have 2 v5 CUs, a v5 TU, and a split v5 CU and TU.
12 .section .debug_str,"MS",@progbits,1
13 str_producer:
14 .asciz "Handmade DWARF producer"
15 str_CU1:
16 .asciz "Compile_Unit_1"
17 str_CU1_dir:
18 .asciz "/home/test/CU1"
19 str_CU2:
20 .asciz "Compile_Unit_2"
21 str_CU2_dir:
22 .asciz "/home/test/CU2"
23 str_TU:
24 .asciz "Type_Unit"
25 str_TU_type:
26 .asciz "MyStruct"
27 str_Subprogram:
28 .asciz "MyFunc"
29 str_Variable1:
30 .asciz "MyVar1"
31 str_Variable2:
32 .asciz "MyVar2"
33 str_Variable3:
34 .asciz "MyVar3"
36 # Every unit contributes to the string_offsets table.
37 .section .debug_str_offsets,"",@progbits
38 # CU1's contribution
39 .long .debug_str_offsets_segment0_end-.debug_str_offsets_base0+4
40 .short 5 # DWARF version
41 .short 0 # Padding
42 .debug_str_offsets_base0:
43 .long str_producer
44 .long str_CU1
45 .long str_CU1_dir
46 .long str_Subprogram
47 .long str_Variable1
48 .long str_Variable2
49 .long str_Variable3
50 .debug_str_offsets_segment0_end:
51 # A 4-byte gap.
52 .long 0
53 # CU2's contribution in DWARF64 format
54 .long 0xffffffff
55 .quad .debug_str_offsets_segment1_end-.debug_str_offsets_base1+4
56 .short 5 # DWARF version
57 .short 0 # Padding
58 .debug_str_offsets_base1:
59 .quad str_producer
60 .quad str_CU2
61 .quad str_CU2_dir
62 .debug_str_offsets_segment1_end:
63 # The TU's contribution
64 .long .debug_str_offsets_segment2_end-.debug_str_offsets_base2+4
65 .short 5 # DWARF version
66 .short 0 # Padding
67 .debug_str_offsets_base2:
68 .long str_TU
69 .long str_TU_type
70 .debug_str_offsets_segment2_end:
72 .section .debug_str.dwo,"MS",@progbits,1
73 dwo_str_CU_5_producer:
74 .asciz "Handmade split DWARF producer"
75 dwo_str_CU_5_name:
76 .asciz "V5_split_compile_unit"
77 dwo_str_CU_5_comp_dir:
78 .asciz "/home/test/splitCU"
79 dwo_str_TU_5:
80 .asciz "V5_split_type_unit"
81 dwo_str_TU_5_type:
82 .asciz "V5_split_Mystruct"
84 .section .debug_str_offsets.dwo,"",@progbits
85 # One contribution only in a .dwo file
86 .long .debug_dwo_str_offsets_segment0_end-.debug_dwo_str_offsets_base0+4
87 .short 5 # DWARF version
88 .short 0 # Padding
89 .debug_dwo_str_offsets_base0:
90 .long dwo_str_CU_5_producer-.debug_str.dwo
91 .long dwo_str_CU_5_name-.debug_str.dwo
92 .long dwo_str_CU_5_comp_dir-.debug_str.dwo
93 .long dwo_str_TU_5-.debug_str.dwo
94 .long dwo_str_TU_5_type-.debug_str.dwo
95 .debug_dwo_str_offsets_segment0_end:
97 # All CUs/TUs use the same abbrev section for simplicity.
98 .section .debug_abbrev,"",@progbits
99 .byte 0x01 # Abbrev code
100 .byte 0x11 # DW_TAG_compile_unit
101 .byte 0x01 # DW_CHILDREN_yes
102 .byte 0x25 # DW_AT_producer
103 .byte 0x1a # DW_FORM_strx
104 .byte 0x03 # DW_AT_name
105 .byte 0x1a # DW_FORM_strx
106 .byte 0x72 # DW_AT_str_offsets_base
107 .byte 0x17 # DW_FORM_sec_offset
108 .byte 0x1b # DW_AT_comp_dir
109 .byte 0x1a # DW_FORM_strx
110 .byte 0x00 # EOM(1)
111 .byte 0x00 # EOM(2)
112 .byte 0x02 # Abbrev code
113 .byte 0x41 # DW_TAG_type_unit
114 .byte 0x01 # DW_CHILDREN_yes
115 .byte 0x03 # DW_AT_name
116 .byte 0x1a # DW_FORM_strx
117 .byte 0x72 # DW_AT_str_offsets_base
118 .byte 0x17 # DW_FORM_sec_offset
119 .byte 0x00 # EOM(1)
120 .byte 0x00 # EOM(2)
121 .byte 0x03 # Abbrev code
122 .byte 0x13 # DW_TAG_structure_type
123 .byte 0x00 # DW_CHILDREN_no (no members)
124 .byte 0x03 # DW_AT_name
125 .byte 0x1a # DW_FORM_strx
126 .byte 0x00 # EOM(1)
127 .byte 0x00 # EOM(2)
128 .byte 0x04 # Abbrev code
129 .byte 0x2e # DW_TAG_subprogram
130 .byte 0x01 # DW_CHILDREN_yes
131 .byte 0x03 # DW_AT_name
132 .byte 0x25 # DW_FORM_strx1
133 .byte 0x00 # EOM(1)
134 .byte 0x00 # EOM(2)
135 .byte 0x05 # Abbrev code
136 .byte 0x34 # DW_TAG_variable
137 .byte 0x00 # DW_CHILDREN_no
138 .byte 0x03 # DW_AT_name
139 .byte 0x26 # DW_FORM_strx2
140 .byte 0x49 # DW_AT_type
141 .byte 0x13 # DW_FORM_ref4
142 .byte 0x00 # EOM(1)
143 .byte 0x00 # EOM(2)
144 .byte 0x06 # Abbrev code
145 .byte 0x34 # DW_TAG_variable
146 .byte 0x00 # DW_CHILDREN_no
147 .byte 0x03 # DW_AT_name
148 .byte 0x27 # DW_FORM_strx3
149 .byte 0x49 # DW_AT_type
150 .byte 0x13 # DW_FORM_ref4
151 .byte 0x00 # EOM(1)
152 .byte 0x00 # EOM(2)
153 .byte 0x07 # Abbrev code
154 .byte 0x34 # DW_TAG_variable
155 .byte 0x00 # DW_CHILDREN_no
156 .byte 0x03 # DW_AT_name
157 .byte 0x28 # DW_FORM_strx4
158 .byte 0x49 # DW_AT_type
159 .byte 0x13 # DW_FORM_ref4
160 .byte 0x00 # EOM(1)
161 .byte 0x00 # EOM(2)
162 .byte 0x08 # Abbrev code
163 .byte 0x24 # DW_TAG_base_type
164 .byte 0x00 # DW_CHILDREN_no
165 .byte 0x3e # DW_AT_encoding
166 .byte 0x0b # DW_FORM_data1
167 .byte 0x00 # EOM(1)
168 .byte 0x00 # EOM(2)
169 .byte 0x09 # Abbrev code
170 .byte 0x11 # DW_TAG_compile_unit
171 .byte 0x00 # DW_CHILDREN_no
172 .byte 0x00 # EOM(1)
173 .byte 0x00 # EOM(2)
174 .byte 0x00 # EOM(3)
176 # And a .dwo copy of a subset for the .dwo sections.
177 .section .debug_abbrev.dwo,"",@progbits
178 .byte 0x01 # Abbrev code
179 .byte 0x11 # DW_TAG_compile_unit
180 .byte 0x00 # DW_CHILDREN_no
181 .byte 0x25 # DW_AT_producer
182 .byte 0x1a # DW_FORM_strx
183 .byte 0x03 # DW_AT_name
184 .byte 0x1a # DW_FORM_strx
185 .byte 0x1b # DW_AT_comp_dir
186 .byte 0x1a # DW_FORM_strx
187 .byte 0x00 # EOM(1)
188 .byte 0x00 # EOM(2)
189 .byte 0x02 # Abbrev code
190 .byte 0x41 # DW_TAG_type_unit
191 .byte 0x01 # DW_CHILDREN_yes
192 .byte 0x03 # DW_AT_name
193 .byte 0x1a # DW_FORM_strx
194 .byte 0x00 # EOM(1)
195 .byte 0x00 # EOM(2)
196 .byte 0x03 # Abbrev code
197 .byte 0x13 # DW_TAG_structure_type
198 .byte 0x00 # DW_CHILDREN_no (no members)
199 .byte 0x03 # DW_AT_name
200 .byte 0x1a # DW_FORM_strx
201 .byte 0x00 # EOM(1)
202 .byte 0x00 # EOM(2)
203 .byte 0x00 # EOM(3)
205 .section .debug_info,"",@progbits
207 # DWARF v5 CU header.
208 .long CU1_5_end-CU1_5_version # Length of Unit
209 CU1_5_version:
210 .short 5 # DWARF version number
211 .byte 1 # DWARF Unit Type
212 .byte 8 # Address Size (in bytes)
213 .long .debug_abbrev # Offset Into Abbrev. Section
214 # The compile-unit DIE, which has a DW_AT_producer, DW_AT_name,
215 # DW_AT_str_offsets and DW_AT_compdir.
216 .byte 1 # Abbreviation code
217 .byte 0 # The index of the producer string
218 .byte 1 # The index of the CU name string
219 .long .debug_str_offsets_base0
220 .byte 2 # The index of the comp dir string
221 # A subprogram DIE with DW_AT_name, using DW_FORM_strx1.
222 .byte 4 # Abbreviation code
223 .byte 3 # Subprogram name string (DW_FORM_strx1)
224 # A variable DIE with DW_AT_name, using DW_FORM_strx2, and DW_AT_type.
225 .byte 5 # Abbreviation code
226 .short 0x0004 # Subprogram name string (DW_FORM_strx2)
227 .long TypeDie-.debug_info
228 # A variable DIE with DW_AT_name, using DW_FORM_strx3, and DW_AT_type.
229 .byte 6 # Abbreviation code
230 .byte 5 # Subprogram name string (DW_FORM_strx3)
231 .short 0 # Subprogram name string (DW_FORM_strx3)
232 .long TypeDie-.debug_info
233 # A variable DIE with DW_AT_name, using DW_FORM_strx4, and DW_AT_type.
234 .byte 7 # Abbreviation code
235 .long 6 # Subprogram name string (DW_FORM_strx4)
236 .long TypeDie-.debug_info
237 .byte 0 # NULL
238 # A base type DIE with DW_AT_encoding.
239 TypeDie:
240 .byte 8 # Abbreviation code
241 .byte 5 # DW_ATE_signed
242 .byte 0 # NULL
243 .byte 0 # NULL
244 CU1_5_end:
246 # DWARF v5 CU header
247 .long 0xffffffff
248 .quad CU2_5_end-CU2_5_version # Length of Unit
249 CU2_5_version:
250 .short 5 # DWARF version number
251 .byte 1 # DWARF Unit Type
252 .byte 8 # Address Size (in bytes)
253 .quad .debug_abbrev # Offset Into Abbrev. Section
254 # The compile-unit DIE, which has a DW_AT_producer, DW_AT_name,
255 # DW_AT_str_offsets and DW_AT_compdir.
256 .byte 1 # Abbreviation code
257 .byte 0 # The index of the producer string
258 .byte 1 # The index of the CU name string
259 .quad .debug_str_offsets_base1
260 .byte 2 # The index of the comp dir string
261 .byte 0 # NULL
262 CU2_5_end:
263 # DWARF v5 CU without str_offsets_base - this shouldn't produce an error/nor
264 # prevent other str_offsets contributions from being dumped.
265 .long CU3_5_end-CU3_5_version # Length of Unit
266 CU3_5_version:
267 .short 5 # DWARF version number
268 .byte 1 # DWARF Unit Type
269 .byte 8 # Address Size (in bytes)
270 .long .debug_abbrev # Offset Into Abbrev. Section
271 # The compile-unit DIE with no attributes.
272 .byte 9 # Abbreviation code
273 CU3_5_end:
280 .section .debug_types,"",@progbits
281 # DWARF v5 Type unit header.
282 TU_5_start:
283 .long TU_5_end-TU_5_version # Length of Unit
284 TU_5_version:
285 .short 5 # DWARF version number
286 .byte 2 # DWARF Unit Type
287 .byte 8 # Address Size (in bytes)
288 .long .debug_abbrev # Offset Into Abbrev. Section
289 .quad 0x0011223344556677 # Type Signature
290 .long TU_5_type-TU_5_start # Type offset
291 # The type-unit DIE, which has a name.
292 .byte 2 # Abbreviation code
293 .byte 0 # Index of the unit type name string
294 .long .debug_str_offsets_base2 # offset into the str_offsets section
295 # The type DIE, which has a name.
296 TU_5_type:
297 .byte 3 # Abbreviation code
298 .byte 1 # Index of the type name string
299 .byte 0 # NULL
300 .byte 0 # NULL
301 TU_5_end:
303 .section .debug_info.dwo,"",@progbits
305 # DWARF v5 split CU header.
306 .long CU_split_5_end-CU_split_5_version # Length of Unit
307 CU_split_5_version:
308 .short 5 # DWARF version number
309 .byte 1 # DWARF Unit Type
310 .byte 8 # Address Size (in bytes)
311 .long .debug_abbrev.dwo # Offset Into Abbrev Section
312 # The compile-unit DIE, which has a DW_AT_producer, DW_AT_name,
313 # DW_AT_str_offsets and DW_AT_compdir.
314 .byte 1 # Abbreviation code
315 .byte 0 # The index of the producer string
316 .byte 1 # The index of the CU name string
317 .byte 2 # The index of the comp dir string
318 .byte 0 # NULL
319 CU_split_5_end:
321 .section .debug_types.dwo,"",@progbits
323 # DWARF v5 split type unit header.
324 TU_split_5_start:
325 .long TU_split_5_end-TU_split_5_version # Length of Unit
326 TU_split_5_version:
327 .short 5 # DWARF version number
328 .byte 6 # DWARF Unit Type
329 .byte 8 # Address Size (in bytes)
330 .long .debug_abbrev.dwo # Offset Into Abbrev Section
331 .quad 0x8899aabbccddeeff # Type Signature
332 .long TU_split_5_type-TU_split_5_start # Type offset
333 # The type-unit DIE, which has a name.
334 .byte 2 # Abbreviation code
335 .byte 3 # The index of the type unit name string
336 # The type DIE, which has a name.
337 TU_split_5_type:
338 .byte 3 # Abbreviation code
339 .byte 4 # The index of the type name string
340 .byte 0 # NULL
341 .byte 0 # NULL
342 TU_split_5_end:
344 # We are using a hand-constructed object file and are interest in the correct
345 # diplay of the DW_str_offsetsbase attribute, the correct display of strings
346 # and the dump of the .debug_str_offsets[.dwo] table.
348 # Abbreviation for DW_AT_str_offsets_base
349 # COMMON: .debug_abbrev contents:
350 # COMMON-NOT: contents:
351 # COMMON: DW_TAG_compile_unit
352 # COMMON-NOT: DW_TAG
353 # COMMON: DW_AT_str_offsets_base DW_FORM_sec_offset
355 # Verify that strings are displayed correctly as indexed strings
356 # COMMON: .debug_info contents:
357 # COMMON-NOT: contents:
358 # COMMON: DW_TAG_compile_unit
359 # COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")
360 # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_1")
361 # COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
362 # COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU1")
363 # COMMON-NOT: NULL
364 # COMMON: DW_TAG_subprogram
365 # COMMON-NEXT: DW_AT_name [DW_FORM_strx1] (indexed (00000003) string = "MyFunc")
366 # COMMON-NOT: NULL
367 # COMMON: DW_TAG_variable
368 # COMMON-NEXT: DW_AT_name [DW_FORM_strx2] (indexed (00000004) string = "MyVar1")
369 # COMMON-NOT: NULL
370 # COMMON: DW_TAG_variable
371 # COMMON-NEXT: DW_AT_name [DW_FORM_strx3] (indexed (00000005) string = "MyVar2")
372 # COMMON-NOT: NULL
373 # COMMON: DW_TAG_variable
374 # COMMON-NEXT: DW_AT_name [DW_FORM_strx4] (indexed (00000006) string = "MyVar3")
376 # Second compile unit (b.cpp)
377 # COMMON: DW_TAG_compile_unit
378 # COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")
379 # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_2")
380 # COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000038)
381 # COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU2")
383 # The split CU
384 # SPLIT: .debug_info.dwo contents:
385 # SPLIT-NOT: contents:
386 # SPLIT: DW_TAG_compile_unit
387 # SPLIT-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade split DWARF producer")
388 # SPLIT-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "V5_split_compile_unit")
389 # SPLIT-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/splitCU")
391 # The type unit
392 # COMMON: .debug_types contents:
393 # COMMON: DW_TAG_type_unit
394 # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000000) string = "Type_Unit")
395 # COMMON: DW_TAG_structure_type
396 # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "MyStruct")
398 # The split type unit
399 # SPLIT: .debug_types.dwo contents:
400 # SPLIT: DW_TAG_type_unit
401 # SPLIT-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000003) string = "V5_split_type_unit")
402 # SPLIT: DW_TAG_structure_type
403 # SPLIT-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000004) string = "V5_split_Mystruct")
405 # The .debug_str_offsets section
406 # COMMON: .debug_str_offsets contents:
407 # COMMON-NEXT: 0x00000000: Contribution size = 32, Format = DWARF32, Version = 5
408 # COMMON-NEXT: 0x00000008: 00000000 "Handmade DWARF producer"
409 # COMMON-NEXT: 0x0000000c: 00000018 "Compile_Unit_1"
410 # COMMON-NEXT: 0x00000010: 00000027 "/home/test/CU1"
411 # COMMON-NEXT: 0x00000014: 00000067 "MyFunc"
412 # COMMON-NEXT: 0x00000018: 0000006e "MyVar1"
413 # COMMON-NEXT: 0x0000001c: 00000075 "MyVar2"
414 # COMMON-NEXT: 0x00000020: 0000007c "MyVar3"
415 # COMMON-NEXT: Gap, length = 4
416 # COMMON-NEXT: 0x00000028: Contribution size = 28, Format = DWARF64, Version = 5
417 # COMMON-NEXT: 0x00000038: 00000000 "Handmade DWARF producer"
418 # COMMON-NEXT: 0x00000040: 00000036 "Compile_Unit_2"
419 # COMMON-NEXT: 0x00000048: 00000045 "/home/test/CU2"
420 # COMMON-NEXT: 0x00000050: Contribution size = 12, Format = DWARF32, Version = 5
421 # COMMON-NEXT: 0x00000058: 00000054 "Type_Unit"
422 # COMMON-NEXT: 0x0000005c: 0000005e "MyStruct"
424 # SPLIT: .debug_str_offsets.dwo contents:
425 # SPLIT-NEXT: 0x00000000: Contribution size = 24, Format = DWARF32, Version = 5
426 # SPLIT-NEXT: 0x00000008: 00000000 "Handmade split DWARF producer"
427 # SPLIT-NEXT: 0x0000000c: 0000001e "V5_split_compile_unit"
428 # SPLIT-NEXT: 0x00000010: 00000034 "/home/test/splitCU"
429 # SPLIT-NEXT: 0x00000014: 00000047 "V5_split_type_unit"
430 # SPLIT-NEXT: 0x00000018: 0000005a "V5_split_Mystruct"
432 # VERIFY: No errors.
434 # ERR-NOT: parsing a range list table: