[OpenACC] Treat 'delete' as a valid clause during parsing in C++ mode
[llvm-project.git] / llvm / test / ObjectYAML / MachO / DWARF5-debug_info.yaml
blob1900189b27242d1212d67f206feb82da9c3dbdb7
1 ## This file contains test cases for generating a DWARFv5 .debug_info
2 ## section in object files from the DWARF entry of Mach-O YAML inputs.
4 ## a) Test that yaml2obj emits a DWARF32 .debug_info sections and obj2yaml
5 ## converts it back.
7 # RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck %s --check-prefix=DWARF32
9 --- !mach-o
10 FileHeader:      
11   magic:           0xFEEDFACF
12   cputype:         0x01000007
13   cpusubtype:      0x00000003
14   filetype:        0x0000000A
15   ncmds:           5
16   sizeofcmds:      1800
17   flags:           0x00000000
18   reserved:        0x00000000
19 LoadCommands:    
20   - cmd:             LC_SEGMENT_64
21     cmdsize:         72
22     segname:         __PAGEZERO
23     vmaddr:          0
24     vmsize:          4294967296
25     fileoff:         0
26     filesize:        0
27     maxprot:         0
28     initprot:        0
29     nsects:          0
30     flags:           0
31   - cmd:             LC_SEGMENT_64
32     cmdsize:         472
33     segname:         __TEXT
34     vmaddr:          4294967296
35     vmsize:          4096
36     fileoff:         0
37     filesize:        0
38     maxprot:         7
39     initprot:        5
40     nsects:          5
41     flags:           0
42     Sections:        
43       - sectname:        __text
44         segname:         __TEXT
45         addr:            0x0000000100000F50
46         size:            52
47         offset:          0x00000000
48         align:           4
49         reloff:          0x00000000
50         nreloc:          0
51         flags:           0x80000400
52         reserved1:       0x00000000
53         reserved2:       0x00000000
54         reserved3:       0x00000000
55       - sectname:        __stubs
56         segname:         __TEXT
57         addr:            0x0000000100000F84
58         size:            6
59         offset:          0x00000000
60         align:           1
61         reloff:          0x00000000
62         nreloc:          0
63         flags:           0x80000408
64         reserved1:       0x00000000
65         reserved2:       0x00000006
66         reserved3:       0x00000000
67       - sectname:        __stub_helper
68         segname:         __TEXT
69         addr:            0x0000000100000F8C
70         size:            26
71         offset:          0x00000000
72         align:           2
73         reloff:          0x00000000
74         nreloc:          0
75         flags:           0x80000400
76         reserved1:       0x00000000
77         reserved2:       0x00000000
78         reserved3:       0x00000000
79       - sectname:        __cstring
80         segname:         __TEXT
81         addr:            0x0000000100000FA6
82         size:            14
83         offset:          0x00000000
84         align:           0
85         reloff:          0x00000000
86         nreloc:          0
87         flags:           0x00000002
88         reserved1:       0x00000000
89         reserved2:       0x00000000
90         reserved3:       0x00000000
91       - sectname:        __unwind_info
92         segname:         __TEXT
93         addr:            0x0000000100000FB4
94         size:            72
95         offset:          0x00000000
96         align:           2
97         reloff:          0x00000000
98         nreloc:          0
99         flags:           0x00000000
100         reserved1:       0x00000000
101         reserved2:       0x00000000
102         reserved3:       0x00000000
103   - cmd:             LC_SEGMENT_64
104     cmdsize:         232
105     segname:         __DATA
106     vmaddr:          4294971392
107     vmsize:          4096
108     fileoff:         0
109     filesize:        0
110     maxprot:         7
111     initprot:        3
112     nsects:          2
113     flags:           0
114     Sections:        
115       - sectname:        __nl_symbol_ptr
116         segname:         __DATA
117         addr:            0x0000000100001000
118         size:            16
119         offset:          0x00000000
120         align:           3
121         reloff:          0x00000000
122         nreloc:          0
123         flags:           0x00000006
124         reserved1:       0x00000001
125         reserved2:       0x00000000
126         reserved3:       0x00000000
127       - sectname:        __la_symbol_ptr
128         segname:         __DATA
129         addr:            0x0000000100001010
130         size:            8
131         offset:          0x00000000
132         align:           3
133         reloff:          0x00000000
134         nreloc:          0
135         flags:           0x00000007
136         reserved1:       0x00000003
137         reserved2:       0x00000000
138         reserved3:       0x00000000
139   - cmd:             LC_SEGMENT_64
140     cmdsize:         72
141     segname:         __LINKEDIT
142     vmaddr:          4294975488
143     vmsize:          4096
144     fileoff:         4096
145     filesize:        60
146     maxprot:         7
147     initprot:        1
148     nsects:          0
149     flags:           0
150   - cmd:             LC_SEGMENT_64
151     cmdsize:         952
152     segname:         __DWARF
153     vmaddr:          4294979584
154     vmsize:          4096
155     fileoff:         8192
156     filesize:        765
157     maxprot:         7
158     initprot:        3
159     nsects:          11
160     flags:           0
161     Sections:        
162       - sectname:        __debug_line
163         segname:         __DWARF
164         addr:            0x0000000100003000
165         size:            69
166         offset:          0x00002000
167         align:           0
168         reloff:          0x00000000
169         nreloc:          0
170         flags:           0x00000000
171         reserved1:       0x00000000
172         reserved2:       0x00000000
173         reserved3:       0x00000000
174       - sectname:        __debug_pubnames
175         segname:         __DWARF
176         addr:            0x0000000100003045
177         size:            27
178         offset:          0x00002045
179         align:           0
180         reloff:          0x00000000
181         nreloc:          0
182         flags:           0x00000000
183         reserved1:       0x00000000
184         reserved2:       0x00000000
185         reserved3:       0x00000000
186       - sectname:        __debug_pubtypes
187         segname:         __DWARF
188         addr:            0x0000000100003060
189         size:            35
190         offset:          0x00002060
191         align:           0
192         reloff:          0x00000000
193         nreloc:          0
194         flags:           0x00000000
195         reserved1:       0x00000000
196         reserved2:       0x00000000
197         reserved3:       0x00000000
198       - sectname:        __debug_aranges
199         segname:         __DWARF
200         addr:            0x0000000100003083
201         size:            48
202         offset:          0x00002083
203         align:           0
204         reloff:          0x00000000
205         nreloc:          0
206         flags:           0x00000000
207         reserved1:       0x00000000
208         reserved2:       0x00000000
209         reserved3:       0x00000000
210       - sectname:        __debug_info
211         segname:         __DWARF
212         addr:            0x00000001000030B3
213         size:            122
214         offset:          0x000020B3
215         align:           0
216         reloff:          0x00000000
217         nreloc:          0
218         flags:           0x00000000
219         reserved1:       0x00000000
220         reserved2:       0x00000000
221         reserved3:       0x00000000
222       - sectname:        __debug_abbrev
223         segname:         __DWARF
224         addr:            0x000000010000312C
225         size:            76
226         offset:          0x0000212D
227         align:           0
228         reloff:          0x00000000
229         nreloc:          0
230         flags:           0x00000000
231         reserved1:       0x00000000
232         reserved2:       0x00000000
233         reserved3:       0x00000000
234       - sectname:        __debug_str
235         segname:         __DWARF
236         addr:            0x0000000100003178
237         size:            142
238         offset:          0x00002179
239         align:           0
240         reloff:          0x00000000
241         nreloc:          0
242         flags:           0x00000000
243         reserved1:       0x00000000
244         reserved2:       0x00000000
245         reserved3:       0x00000000
246       - sectname:        __apple_names
247         segname:         __DWARF
248         addr:            0x0000000100003206
249         size:            60
250         offset:          0x00002207
251         align:           0
252         reloff:          0x00000000
253         nreloc:          0
254         flags:           0x00000000
255         reserved1:       0x00000000
256         reserved2:       0x00000000
257         reserved3:       0x00000000
258       - sectname:        __apple_namespac
259         segname:         __DWARF
260         addr:            0x0000000100003242
261         size:            36
262         offset:          0x00002243
263         align:           0
264         reloff:          0x00000000
265         nreloc:          0
266         flags:           0x00000000
267         reserved1:       0x00000000
268         reserved2:       0x00000000
269         reserved3:       0x00000000
270       - sectname:        __apple_types
271         segname:         __DWARF
272         addr:            0x0000000100003266
273         size:            114
274         offset:          0x00002267
275         align:           0
276         reloff:          0x00000000
277         nreloc:          0
278         flags:           0x00000000
279         reserved1:       0x00000000
280         reserved2:       0x00000000
281         reserved3:       0x00000000
282       - sectname:        __apple_objc
283         segname:         __DWARF
284         addr:            0x00000001000032D8
285         size:            36
286         offset:          0x000022D9
287         align:           0
288         reloff:          0x00000000
289         nreloc:          0
290         flags:           0x00000000
291         reserved1:       0x00000000
292         reserved2:       0x00000000
293         reserved3:       0x00000000
294 LinkEditData:    
295   NameList:        
296     - n_strx:          2
297       n_type:          0x0F
298       n_sect:          1
299       n_desc:          16
300       n_value:         4294967296
301     - n_strx:          22
302       n_type:          0x0F
303       n_sect:          1
304       n_desc:          0
305       n_value:         4294971216
306   StringTable:     
307     - ''
308     - ''
309     - __mh_execute_header
310     - _main
311 DWARF:           
312   debug_abbrev:    
313     - Table:
314         - Code:            0x00000001
315           Tag:             DW_TAG_compile_unit
316           Children:        DW_CHILDREN_yes
317           Attributes:
318             - Attribute:       DW_AT_producer
319               Form:            DW_FORM_strp
320             - Attribute:       DW_AT_language
321               Form:            DW_FORM_data2
322             - Attribute:       DW_AT_name
323               Form:            DW_FORM_strp
324             - Attribute:       DW_AT_stmt_list
325               Form:            DW_FORM_sec_offset
326             - Attribute:       DW_AT_comp_dir
327               Form:            DW_FORM_strp
328             - Attribute:       DW_AT_low_pc
329               Form:            DW_FORM_addr
330             - Attribute:       DW_AT_high_pc
331               Form:            DW_FORM_data4
332         - Code:            0x00000002
333           Tag:             DW_TAG_subprogram
334           Children:        DW_CHILDREN_yes
335           Attributes:
336             - Attribute:       DW_AT_low_pc
337               Form:            DW_FORM_addr
338             - Attribute:       DW_AT_high_pc
339               Form:            DW_FORM_data4
340             - Attribute:       DW_AT_frame_base
341               Form:            DW_FORM_exprloc
342             - Attribute:       DW_AT_name
343               Form:            DW_FORM_strp
344             - Attribute:       DW_AT_decl_file
345               Form:            DW_FORM_data1
346             - Attribute:       DW_AT_decl_line
347               Form:            DW_FORM_data1
348             - Attribute:       DW_AT_prototyped
349               Form:            DW_FORM_flag_present
350             - Attribute:       DW_AT_type
351               Form:            DW_FORM_ref4
352             - Attribute:       DW_AT_external
353               Form:            DW_FORM_flag_present
354         - Code:            0x00000003
355           Tag:             DW_TAG_formal_parameter
356           Children:        DW_CHILDREN_no
357           Attributes:
358             - Attribute:       DW_AT_location
359               Form:            DW_FORM_exprloc
360             - Attribute:       DW_AT_name
361               Form:            DW_FORM_strp
362             - Attribute:       DW_AT_decl_file
363               Form:            DW_FORM_data1
364             - Attribute:       DW_AT_decl_line
365               Form:            DW_FORM_data1
366             - Attribute:       DW_AT_type
367               Form:            DW_FORM_ref4
368         - Code:            0x00000004
369           Tag:             DW_TAG_base_type
370           Children:        DW_CHILDREN_no
371           Attributes:
372             - Attribute:       DW_AT_name
373               Form:            DW_FORM_strp
374             - Attribute:       DW_AT_encoding
375               Form:            DW_FORM_data1
376             - Attribute:       DW_AT_byte_size
377               Form:            DW_FORM_data1
378         - Code:            0x00000005
379           Tag:             DW_TAG_pointer_type
380           Children:        DW_CHILDREN_no
381           Attributes:
382             - Attribute:       DW_AT_type
383               Form:            DW_FORM_ref4
384   debug_aranges:   
385     - Length:              44
386       Version:             2
387       CuOffset:            0
388       AddressSize:         8
389       SegmentSelectorSize: 0
390       Descriptors:     
391         - Address:         0x0000000100000F50
392           Length:          52
393   debug_info:      
394     - Length:          118
395       Version:         5
396       UnitType:        DW_UT_compile
397       AbbrOffset:      0
398       AddrSize:        8
399       Entries:         
400         - AbbrCode:        0x00000001
401           Values:          
402             - Value:           0x0000000000000001
403             - Value:           0x000000000000000C
404             - Value:           0x0000000000000038
405             - Value:           0x0000000000000000
406             - Value:           0x0000000000000046
407             - Value:           0x0000000100000F50
408             - Value:           0x0000000000000034
409         - AbbrCode:        0x00000002
410           Values:          
411             - Value:           0x0000000100000F50
412             - Value:           0x0000000000000034
413             - Value:           0x0000000000000001
414               BlockData:       
415                 - 0x56
416             - Value:           0x0000000000000076
417             - Value:           0x0000000000000001
418             - Value:           0x0000000000000003
419             - Value:           0x0000000000000001
420             - Value:           0x0000000000000060
421             - Value:           0x0000000000000001
422         - AbbrCode:        0x00000003
423           Values:          
424             - Value:           0x0000000000000002
425               BlockData:       
426                 - 0x91
427                 - 0x78
428             - Value:           0x000000000000007B
429             - Value:           0x0000000000000001
430             - Value:           0x0000000000000003
431             - Value:           0x0000000000000060
432         - AbbrCode:        0x00000003
433           Values:          
434             - Value:           0x0000000000000002
435               BlockData:       
436                 - 0x91
437                 - 0x70
438             - Value:           0x0000000000000080
439             - Value:           0x0000000000000001
440             - Value:           0x0000000000000003
441             - Value:           0x0000000000000067
442         - AbbrCode:        0x00000000
443         - AbbrCode:        0x00000004
444           Values:          
445             - Value:           0x0000000000000085
446             - Value:           0x0000000000000005
447             - Value:           0x0000000000000004
448         - AbbrCode:        0x00000005
449           Values:          
450             - Value:           0x000000000000006C
451         - AbbrCode:        0x00000005
452           Values:          
453             - Value:           0x0000000000000071
454         - AbbrCode:        0x00000004
455           Values:          
456             - Value:           0x0000000000000089
457             - Value:           0x0000000000000006
458             - Value:           0x0000000000000001
459         - AbbrCode:        0x00000000
460   debug_line:      
461     - Length:          65
462       Version:         2
463       PrologueLength:  36
464       MinInstLength:   1
465       DefaultIsStmt:   1
466       LineBase:        251
467       LineRange:       14
468       OpcodeBase:      13
469       StandardOpcodeLengths: 
470         - 0
471         - 1
472         - 1
473         - 1
474         - 1
475         - 0
476         - 0
477         - 0
478         - 1
479         - 0
480         - 0
481         - 1
482       Files:           
483         - Name:            hello_world.c
484           DirIdx:          0
485           ModTime:         0
486           Length:          0
487       Opcodes:         
488         - Opcode:          DW_LNS_extended_op
489           ExtLen:          9
490           SubOpcode:       DW_LNE_set_address
491           Data:            4294971216
492         - Opcode:          0x14
493           Data:            4294971216
494         - Opcode:          DW_LNS_set_column
495           Data:            3
496         - Opcode:          DW_LNS_set_prologue_end
497           Data:            3
498         - Opcode:          DW_LNS_const_add_pc
499           Data:            3
500         - Opcode:          0xBB
501           Data:            3
502         - Opcode:          0xBB
503           Data:            3
504         - Opcode:          DW_LNS_advance_pc
505           Data:            11
506         - Opcode:          DW_LNS_extended_op
507           ExtLen:          1
508           SubOpcode:       DW_LNE_end_sequence
509           Data:            11
512 #      DWARF32: DWARF:
513 #      DWARF32:   debug_info:
514 # DWARF32-NEXT:     - Length:        0x76
515 # DWARF32-NEXT:       Version:       5
516 # DWARF32-NEXT:       UnitType:      DW_UT_compile
517 # DWARF32-NEXT:       AbbrevTableID: 0
518 # DWARF32-NEXT:       AbbrOffset:    0
519 # DWARF32-NEXT:       AddrSize:      8
520 # DWARF32-NEXT:       Entries:
521 # DWARF32-NEXT:         - AbbrCode: 0x1
522 # DWARF32-NEXT:           Values:
523 # DWARF32-NEXT:             - Value: 0x1
524 # DWARF32-NEXT:             - Value: 0xC
525 # DWARF32-NEXT:             - Value: 0x38
526 # DWARF32-NEXT:             - Value: 0x0
527 # DWARF32-NEXT:             - Value: 0x46
528 # DWARF32-NEXT:             - Value: 0x100000F50
529 # DWARF32-NEXT:             - Value: 0x34
530 # DWARF32-NEXT:         - AbbrCode: 0x2
531 # DWARF32-NEXT:           Values:
532 # DWARF32-NEXT:             - Value: 0x100000F50
533 # DWARF32-NEXT:             - Value: 0x34
534 # DWARF32-NEXT:             - Value: 0x1
535 # DWARF32-NEXT:               BlockData: [ 0x56 ]
536 # DWARF32-NEXT:             - Value: 0x76
537 # DWARF32-NEXT:             - Value: 0x1
538 # DWARF32-NEXT:             - Value: 0x3
539 # DWARF32-NEXT:             - Value: 0x1
540 # DWARF32-NEXT:             - Value: 0x60
541 # DWARF32-NEXT:             - Value: 0x1
542 # DWARF32-NEXT:         - AbbrCode: 0x3
543 # DWARF32-NEXT:           Values:
544 # DWARF32-NEXT:             - Value: 0x2
545 # DWARF32-NEXT:               BlockData: [ 0x91, 0x78 ]
546 # DWARF32-NEXT:             - Value: 0x7B
547 # DWARF32-NEXT:             - Value: 0x1
548 # DWARF32-NEXT:             - Value: 0x3
549 # DWARF32-NEXT:             - Value: 0x60
550 # DWARF32-NEXT:         - AbbrCode:        0x3
551 # DWARF32-NEXT:           Values:          
552 # DWARF32-NEXT:             - Value:           0x2
553 # DWARF32-NEXT:               BlockData:       [ 0x91, 0x70 ]
554 # DWARF32-NEXT:             - Value:           0x80
555 # DWARF32-NEXT:             - Value:           0x1
556 # DWARF32-NEXT:             - Value:           0x3
557 # DWARF32-NEXT:             - Value:           0x67
558 # DWARF32-NEXT:         - AbbrCode:        0x0
559 # DWARF32-NEXT:         - AbbrCode:        0x4
560 # DWARF32-NEXT:           Values:          
561 # DWARF32-NEXT:             - Value:           0x85
562 # DWARF32-NEXT:             - Value:           0x5
563 # DWARF32-NEXT:             - Value:           0x4
564 # DWARF32-NEXT:         - AbbrCode:        0x5
565 # DWARF32-NEXT:           Values:          
566 # DWARF32-NEXT:             - Value:           0x6C
567 # DWARF32-NEXT:         - AbbrCode:        0x5
568 # DWARF32-NEXT:           Values:          
569 # DWARF32-NEXT:             - Value:           0x71
570 # DWARF32-NEXT:         - AbbrCode:        0x4
571 # DWARF32-NEXT:           Values:          
572 # DWARF32-NEXT:             - Value:           0x89
573 # DWARF32-NEXT:             - Value:           0x6
574 # DWARF32-NEXT:             - Value:           0x1
575 # DWARF32-NEXT:         - AbbrCode:        0x0
577 ## b) Test that yaml2obj emits a correct unit header and obj2yaml is able to convert it back.
579 ## Test DWARF32 unit header.
581 # RUN: yaml2obj --docnum=2 -DFORMAT=DWARF32 -DLENGTH=12 %s | \
582 # RUN:   obj2yaml | FileCheck %s --check-prefix=DWARF32-YAML
584 #      DWARF32-YAML: debug_info:
585 # DWARF32-YAML-NEXT:   - Length:        0xC
586 # DWARF32-YAML-NEXT:     Version:       5
587 # DWARF32-YAML-NEXT:     UnitType:      DW_UT_compile
588 # DWARF32-YAML-NEXT:     AbbrevTableID: 0
589 # DWARF32-YAML-NEXT:     AbbrOffset:    0x0
590 # DWARF32-YAML-NEXT:     AddrSize:      8
591 # DWARF32-YAML-NEXT:     Entries:
592 # DWARF32-YAML-NEXT:       - AbbrCode: 0x1
593 # DWARF32-YAML-NEXT:         Values:
594 # DWARF32-YAML-NEXT:           - Value: 0x1234
596 --- !mach-o
597 FileHeader:
598   magic:      0xFEEDFACF
599   cputype:    0x01000007
600   cpusubtype: 0x00000003
601   filetype:   0x0000000A
602   ncmds:      1
603   sizeofcmds: 232
604   flags:      0x00000000
605   reserved:   0x00000000
606 LoadCommands:
607   - cmd:      LC_SEGMENT_64
608     cmdsize:  232
609     segname:  __DWARF
610     vmaddr:   0x00
611     vmsize:   0x00
612     fileoff:  0x00
613     filesize: 0x00
614     maxprot:  0
615     initprot: 0
616     nsects:   2
617     flags:    0
618     Sections:
619       - sectname:  __debug_abbrev
620         segname:   __DWARF
621         addr:      0x00
622         size:      12
623         offset:    528
624         align:     0
625         reloff:    0x00000000
626         nreloc:    0
627         flags:     0x00000000
628         reserved1: 0x00000000
629         reserved2: 0x00000000
630         reserved3: 0x00000000
631       - sectname:  __debug_info
632         segname:   __DWARF
633         addr:      0x00
634         size:      0xffff
635         offset:    1070
636         align:     0
637         reloff:    0x00000000
638         nreloc:    0
639         flags:     0x00000000
640         reserved1: 0x00000000
641         reserved2: 0x00000000
642         reserved3: 0x00000000
643 DWARF:
644   debug_abbrev:    
645     - Table:
646         - Code:     1
647           Tag:      DW_TAG_compile_unit
648           Children: DW_CHILDREN_no
649           Attributes:
650             - Attribute: DW_AT_low_pc
651               Form:      DW_FORM_addr
652   debug_info:
653     - Format:     [[FORMAT]]
654       Length:     [[LENGTH]]
655       Version:    5
656       UnitType:   DW_UT_compile
657       AbbrOffset: 0
658       AddrSize:   8
659       Entries:
660         - AbbrCode: 1
661           Values:
662             - Value: 0x1234
664 ## Test DWARF64 unit header.
666 # RUN: yaml2obj --docnum=2 -DFORMAT=DWARF64 -DLENGTH=20 %s | \
667 # RUN:   obj2yaml | FileCheck %s --check-prefix=DWARF64-YAML
669 #      DWARF64-YAML: debug_info:
670 # DWARF64-YAML-NEXT:   - Format:        DWARF64
671 # DWARF64-YAML-NEXT:     Length:        0x14
672 # DWARF64-YAML-NEXT:     Version:       5
673 # DWARF64-YAML-NEXT:     UnitType:      DW_UT_compile
674 # DWARF64-YAML-NEXT:     AbbrevTableID: 0
675 # DWARF64-YAML-NEXT:     AbbrOffset:    0x0
676 # DWARF64-YAML-NEXT:     AddrSize:      8
677 # DWARF64-YAML-NEXT:     Entries:
678 # DWARF64-YAML-NEXT:       - AbbrCode: 0x1
679 # DWARF64-YAML-NEXT:         Values:
680 # DWARF64-YAML-NEXT:           - Value: 0x1234