[Alignment][NFC] Migrate Instructions to Align
[llvm-core.git] / test / DebugInfo / X86 / dwarfdump-header.s
blobdaf03614f9daa0fa2ca66a368840cc924cd3fda3
1 # Test object to verify dwarfdump handles v4 and v5 CU/TU/line headers.
2 # We have a representative set of units: v4 CU, v5 CU, v4 TU, v5 split TU.
3 # We have v4 and v5 line-table headers.
5 # RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
6 # RUN: llvm-dwarfdump -v %t.o | FileCheck %s
7 # RUN: llvm-dwarfdump -verify %t.o | FileCheck %s --check-prefix=VERIFY
9 .section .debug_str,"MS",@progbits,1
10 str_producer:
11 .asciz "Handmade DWARF producer"
12 str_CU_4:
13 .asciz "V4_compile_unit"
14 str_CU_5:
15 .asciz "V5_compile_unit"
16 str_TU_4:
17 .asciz "V4_type_unit"
18 str_LT_5a:
19 .asciz "Directory5a"
20 str_LT_5b:
21 .asciz "Directory5b"
23 .section .debug_str.dwo,"MS",@progbits,1
24 dwo_TU_5:
25 .asciz "V5_split_type_unit"
26 dwo_producer:
27 .asciz "Handmade DWO producer"
28 dwo_CU_5:
29 .asciz "V5_dwo_compile_unit"
30 dwo_LT_5a:
31 .asciz "DWODirectory5a"
32 dwo_LT_5b:
33 .asciz "DWODirectory5b"
35 # All CUs/TUs use the same abbrev section for simplicity.
36 .section .debug_abbrev,"",@progbits
37 .byte 0x01 # Abbrev code
38 .byte 0x11 # DW_TAG_compile_unit
39 .byte 0x00 # DW_CHILDREN_no
40 .byte 0x25 # DW_AT_producer
41 .byte 0x0e # DW_FORM_strp
42 .byte 0x03 # DW_AT_name
43 .byte 0x0e # DW_FORM_strp
44 .byte 0x10 # DW_AT_stmt_list
45 .byte 0x17 # DW_FORM_sec_offset
46 .byte 0x00 # EOM(1)
47 .byte 0x00 # EOM(2)
48 .byte 0x02 # Abbrev code
49 .byte 0x41 # DW_TAG_type_unit
50 .byte 0x01 # DW_CHILDREN_yes
51 .byte 0x03 # DW_AT_name
52 .byte 0x0e # DW_FORM_strp
53 .byte 0x00 # EOM(1)
54 .byte 0x00 # EOM(2)
55 .byte 0x03 # Abbrev code
56 .byte 0x13 # DW_TAG_structure_type
57 .byte 0x00 # DW_CHILDREN_no (no members)
58 .byte 0x03 # DW_AT_name
59 .byte 0x0e # DW_FORM_strp
60 .byte 0x00 # EOM(1)
61 .byte 0x00 # EOM(2)
62 .byte 0x00 # EOM(3)
64 # And a .dwo copy for the .dwo sections.
65 .section .debug_abbrev.dwo,"",@progbits
66 .byte 0x01 # Abbrev code
67 .byte 0x11 # DW_TAG_compile_unit
68 .byte 0x00 # DW_CHILDREN_no
69 .byte 0x25 # DW_AT_producer
70 .byte 0x0e # DW_FORM_strp
71 .byte 0x03 # DW_AT_name
72 .byte 0x0e # DW_FORM_strp
73 .byte 0x10 # DW_AT_stmt_list
74 .byte 0x17 # DW_FORM_sec_offset
75 .byte 0x00 # EOM(1)
76 .byte 0x00 # EOM(2)
77 .byte 0x02 # Abbrev code
78 .byte 0x41 # DW_TAG_type_unit
79 .byte 0x01 # DW_CHILDREN_yes
80 .byte 0x03 # DW_AT_name
81 .byte 0x0e # DW_FORM_strp
82 .byte 0x00 # EOM(1)
83 .byte 0x00 # EOM(2)
84 .byte 0x03 # Abbrev code
85 .byte 0x13 # DW_TAG_structure_type
86 .byte 0x00 # DW_CHILDREN_no (no members)
87 .byte 0x03 # DW_AT_name
88 .byte 0x0e # DW_FORM_strp
89 .byte 0x00 # EOM(1)
90 .byte 0x00 # EOM(2)
91 .byte 0x00 # EOM(3)
93 .section .debug_info,"",@progbits
94 # CHECK-LABEL: .debug_info contents:
96 # DWARF v4 CU header. V4 CU headers all look the same so we do only one.
97 .long CU_4_end-CU_4_version # Length of Unit
98 CU_4_version:
99 .short 4 # DWARF version number
100 .long .debug_abbrev # Offset Into Abbrev. Section
101 .byte 8 # Address Size (in bytes)
102 # The compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list.
103 .byte 1
104 .long str_producer
105 .long str_CU_4
106 .long LH_4_start
107 .byte 0 # NULL
108 CU_4_end:
110 # CHECK: 0x00000000: Compile Unit: length = 0x00000015 version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000019)
111 # CHECK: 0x0000000b: DW_TAG_compile_unit
113 # DWARF v5 normal CU header.
114 .long CU_5_end-CU_5_version # Length of Unit
115 CU_5_version:
116 .short 5 # DWARF version number
117 .byte 1 # DWARF Unit Type
118 .byte 8 # Address Size (in bytes)
119 .long .debug_abbrev # Offset Into Abbrev. Section
120 # The compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list.
121 .byte 1
122 .long str_producer
123 .long str_CU_5
124 .long LH_5_start
125 .byte 0 # NULL
126 CU_5_end:
128 # CHECK: 0x00000019: Compile Unit: length = 0x00000016 version = 0x0005 unit_type = DW_UT_compile abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000033)
129 # CHECK: 0x00000025: DW_TAG_compile_unit
131 .section .debug_info.dwo,"",@progbits
132 # CHECK-LABEL: .debug_info.dwo
134 # DWARF v5 split CU header.
135 .long CU_split_5_end-CU_split_5_version # Length of Unit
136 CU_split_5_version:
137 .short 5 # DWARF version number
138 .byte 5 # DWARF Unit Type
139 .byte 8 # Address Size (in bytes)
140 .long .debug_abbrev.dwo # Offset Into Abbrev. Section
141 .quad 0x5a # DWO ID
142 # The split compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list.
143 .byte 1
144 .long dwo_producer
145 .long dwo_CU_5
146 .long dwo_LH_5_start
147 .byte 0 # NULL
148 CU_split_5_end:
150 # CHECK: 0x00000000: Compile Unit: length = 0x0000001e version = 0x0005 unit_type = DW_UT_split_compile abbr_offset = 0x0000 addr_size = 0x08 DWO_id = 0x000000000000005a (next unit at 0x00000022)
151 # CHECK: 0x00000014: DW_TAG_compile_unit
152 # CHECK-NEXT: DW_AT_producer {{.*}} "Handmade DWO producer"
153 # CHECK-NEXT: DW_AT_name {{.*}} "V5_dwo_compile_unit"
155 # Now a DWARF v5 type unit, which goes in a .debug_info.dwo comdat.
156 # Note there will not be another ".debug_info.dwo contents:" line, even though
157 # there is a separate ELF section header; it's dumped along with the previous
158 # unit as if they were in a single section.
160 .section .debug_info.dwo,"G",@progbits,5555,comdat
161 # CHECK-NOT: .debug_info.dwo
163 # DWARF v5 split type unit header.
164 TU_split_5_start:
165 .long TU_split_5_end-TU_split_5_version # Length of Unit
166 TU_split_5_version:
167 .short 5 # DWARF version number
168 .byte 6 # DWARF Unit Type
169 .byte 8 # Address Size (in bytes)
170 .long .debug_abbrev.dwo # Offset Into Abbrev. Section
171 .quad 0x8899aabbccddeeff # Type Signature
172 .long TU_split_5_type-TU_split_5_start # Type offset
173 # The type-unit DIE, which has a name.
174 .byte 2
175 .long dwo_TU_5
176 # The type DIE, which has a name.
177 TU_split_5_type:
178 .byte 3
179 .long dwo_TU_5
180 .byte 0 # NULL
181 .byte 0 # NULL
182 TU_split_5_end:
184 # CHECK: 0x00000000: Type Unit: length = 0x00000020 version = 0x0005 unit_type = DW_UT_split_type abbr_offset = 0x0000 addr_size = 0x08 name = 'V5_split_type_unit' type_signature = 0x8899aabbccddeeff type_offset = 0x001d (next unit at 0x00000024)
185 # CHECK: 0x00000018: DW_TAG_type_unit
187 .section .debug_types,"",@progbits
188 # CHECK-LABEL: .debug_types contents:
190 # DWARF v4 Type unit header. Normal/split are identical so we do only one.
191 TU_4_start:
192 .long TU_4_end-TU_4_version # Length of Unit
193 TU_4_version:
194 .short 4 # DWARF version number
195 .long .debug_abbrev # Offset Into Abbrev. Section
196 .byte 8 # Address Size (in bytes)
197 .quad 0x0011223344556677 # Type Signature
198 .long TU_4_type-TU_4_start # Type offset
199 # The type-unit DIE, which has a name.
200 .byte 2
201 .long str_TU_4
202 # The type DIE, which has a name.
203 TU_4_type:
204 .byte 3
205 .long str_TU_4
206 .byte 0 # NULL
207 .byte 0 # NULL
208 TU_4_end:
210 # CHECK: 0x00000000: Type Unit: length = 0x0000001f version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 name = 'V4_type_unit' type_signature = 0x0011223344556677 type_offset = 0x001c (next unit at 0x00000023)
211 # CHECK: 0x00000017: DW_TAG_type_unit
213 .section .debug_line,"",@progbits
214 # CHECK-LABEL: .debug_line contents:
216 # DWARF v4 line-table header.
217 LH_4_start:
218 .long LH_4_end-LH_4_version # Length of Unit
219 LH_4_version:
220 .short 4 # DWARF version number
221 .long LH_4_header_end-LH_4_params # Length of Prologue
222 LH_4_params:
223 .byte 1 # Minimum Instruction Length
224 .byte 1 # Maximum Operations per Instruction
225 .byte 1 # Default is_stmt
226 .byte -5 # Line Base
227 .byte 14 # Line Range
228 .byte 13 # Opcode Base
229 .byte 0 # Standard Opcode Lengths
230 .byte 1
231 .byte 1
232 .byte 1
233 .byte 1
234 .byte 0
235 .byte 0
236 .byte 0
237 .byte 1
238 .byte 0
239 .byte 0
240 .byte 1
241 # Directory table
242 .asciz "Directory4a"
243 .asciz "Directory4b"
244 .byte 0
245 # File table
246 .asciz "File4a" # File name 1
247 .byte 1 # Directory index 1
248 .byte 0x41 # Timestamp 1
249 .byte 0x42 # File Size 1
250 .asciz "File4b" # File name 2
251 .byte 0 # Directory index 2
252 .byte 0x43 # Timestamp 2
253 .byte 0x44 # File Size 2
254 .byte 0 # End of list
255 LH_4_header_end:
256 # Line number program, which is empty.
257 LH_4_end:
259 # CHECK: Line table prologue:
260 # CHECK: version: 4
261 # CHECK-NOT: address_size
262 # CHECK-NOT: seg_select_size
263 # CHECK: max_ops_per_inst: 1
264 # CHECK: include_directories[ 1] = "Directory4a"
265 # CHECK: include_directories[ 2] = "Directory4b"
266 # CHECK-NOT: include_directories
267 # CHECK: file_names[ 1]:
268 # CHECK-NEXT: name: "File4a"
269 # CHECK-NEXT: dir_index: 1
270 # CHECK-NEXT: mod_time: 0x00000041
271 # CHECK-NEXT: length: 0x00000042
272 # CHECK: file_names[ 2]:
273 # CHECK-NEXT: name: "File4b"
274 # CHECK-NEXT: dir_index: 0
275 # CHECK-NEXT: mod_time: 0x00000043
276 # CHECK-NEXT: length: 0x00000044
277 # CHECK-NOT: file_names
279 # DWARF v5 line-table header.
280 LH_5_start:
281 .long LH_5_end-LH_5_version # Length of Unit
282 LH_5_version:
283 .short 5 # DWARF version number
284 .byte 8 # Address Size
285 .byte 0 # Segment Selector Size
286 .long LH_5_header_end-LH_5_params # Length of Prologue
287 LH_5_params:
288 .byte 1 # Minimum Instruction Length
289 .byte 1 # Maximum Operations per Instruction
290 .byte 1 # Default is_stmt
291 .byte -5 # Line Base
292 .byte 14 # Line Range
293 .byte 13 # Opcode Base
294 .byte 0 # Standard Opcode Lengths
295 .byte 1
296 .byte 1
297 .byte 1
298 .byte 1
299 .byte 0
300 .byte 0
301 .byte 0
302 .byte 1
303 .byte 0
304 .byte 0
305 .byte 1
306 # Directory table format
307 .byte 1 # One element per directory entry
308 .byte 1 # DW_LNCT_path
309 .byte 0x0e # DW_FORM_strp (-> .debug_str)
310 # Directory table entries
311 .byte 2 # Two directories
312 .long str_LT_5a
313 .long str_LT_5b
314 # File table format
315 .byte 3 # Three elements per file entry
316 .byte 1 # DW_LNCT_path
317 .byte 0x1f # DW_FORM_line_strp (-> .debug_line_str)
318 .byte 2 # DW_LNCT_directory_index
319 .byte 0x0b # DW_FORM_data1
320 .byte 5 # DW_LNCT_MD5
321 .byte 0x1e # DW_FORM_data16
322 # File table entries
323 .byte 2 # Two files
324 .long lstr_LT_5a
325 .byte 0
326 .quad 0x7766554433221100
327 .quad 0xffeeddccbbaa9988
328 .long lstr_LT_5b
329 .byte 1
330 .quad 0x8899aabbccddeeff
331 .quad 0x0011223344556677
332 LH_5_header_end:
333 # Line number program, which is empty.
334 LH_5_end:
336 # CHECK: Line table prologue:
337 # CHECK: version: 5
338 # CHECK: address_size: 8
339 # CHECK: seg_select_size: 0
340 # CHECK: max_ops_per_inst: 1
341 # Mixing .debug_str (here) with .debug_line_str (in file_names) is not
342 # something a producer would do, but both are legal and we want to test them.
343 # CHECK: include_directories[ 0] = .debug_str[0x00000045] = "Directory5a"
344 # CHECK: include_directories[ 1] = .debug_str[0x00000051] = "Directory5b"
345 # CHECK-NOT: include_directories
346 # CHECK: file_names[ 0]:
347 # CHECK-NEXT: name: .debug_line_str[0x00000000] = "File5a"
348 # CHECK-NEXT: dir_index: 0
349 # CHECK-NEXT: md5_checksum: 00112233445566778899aabbccddeeff
350 # CHECK: file_names[ 1]:
351 # CHECK-NEXT: name: .debug_line_str[0x00000007] = "File5b"
352 # CHECK-NEXT: dir_index: 1
353 # CHECK-NEXT: md5_checksum: ffeeddccbbaa99887766554433221100
354 # CHECK-NOT: file_names
356 .section .debug_line_str,"MS",@progbits,1
357 lstr_LT_5a:
358 .asciz "File5a"
359 lstr_LT_5b:
360 .asciz "File5b"
362 .section .debug_line.dwo,"",@progbits
363 # CHECK-LABEL: .debug_line.dwo
365 # DWARF v5 DWO line-table header.
366 dwo_LH_5_start:
367 .long dwo_LH_5_end-dwo_LH_5_version # Length of Unit
368 dwo_LH_5_version:
369 .short 5 # DWARF version number
370 .byte 8 # Address Size
371 .byte 0 # Segment Selector Size
372 .long dwo_LH_5_header_end-dwo_LH_5_params # Length of Prologue
373 dwo_LH_5_params:
374 .byte 1 # Minimum Instruction Length
375 .byte 1 # Maximum Operations per Instruction
376 .byte 1 # Default is_stmt
377 .byte -5 # Line Base
378 .byte 14 # Line Range
379 .byte 13 # Opcode Base
380 .byte 0 # Standard Opcode Lengths
381 .byte 1
382 .byte 1
383 .byte 1
384 .byte 1
385 .byte 0
386 .byte 0
387 .byte 0
388 .byte 1
389 .byte 0
390 .byte 0
391 .byte 1
392 # Directory table format
393 .byte 1 # One element per directory entry
394 .byte 1 # DW_LNCT_path
395 .byte 0x0e # DW_FORM_strp (-> .debug_str.dwo)
396 # Directory table entries
397 .byte 2 # Two directories
398 .long dwo_LT_5a
399 .long dwo_LT_5b
400 # File table format
401 .byte 4 # Four elements per file entry
402 .byte 1 # DW_LNCT_path
403 .byte 0x08 # DW_FORM_string
404 .byte 2 # DW_LNCT_directory_index
405 .byte 0x0b # DW_FORM_data1
406 .byte 3 # DW_LNCT_timestamp
407 .byte 0x0f # DW_FORM_udata
408 .byte 4 # DW_LNCT_size
409 .byte 0x0f # DW_FORM_udata
410 # File table entries
411 .byte 2 # Two files
412 .asciz "DWOFile5a"
413 .byte 0
414 .byte 0x15
415 .byte 0x25
416 .asciz "DWOFile5b"
417 .byte 1
418 .byte 0x35
419 .byte 0x45
420 dwo_LH_5_header_end:
421 # Line number program, which is empty.
422 dwo_LH_5_end:
424 # CHECK: Line table prologue:
425 # CHECK: version: 5
426 # CHECK: address_size: 8
427 # CHECK: seg_select_size: 0
428 # CHECK: max_ops_per_inst: 1
429 # CHECK: include_directories[ 0] = .debug_str[0x0000003d] = "DWODirectory5a"
430 # CHECK: include_directories[ 1] = .debug_str[0x0000004c] = "DWODirectory5b"
431 # CHECK-NOT: include_directories
432 # CHECK: file_names[ 0]:
433 # CHECK-NEXT: name: "DWOFile5a"
434 # CHECK-NEXT: dir_index: 0
435 # CHECK-NEXT: mod_time: 0x00000015
436 # CHECK-NEXT: length: 0x00000025
437 # CHECK: file_names[ 1]:
438 # CHECK-NEXT: name: "DWOFile5b"
439 # CHECK-NEXT: dir_index: 1
440 # CHECK-NEXT: mod_time: 0x00000035
441 # CHECK-NEXT: length: 0x00000045
442 # CHECK-NOT: file_names
444 # VERIFY: Verifying .debug_types
445 # VERIFY: No errors.