1# RUN: yaml2obj %s | obj2yaml | FileCheck %s
2
3--- !mach-o
4FileHeader:      
5  magic:           0xFEEDFACF
6  cputype:         0x01000007
7  cpusubtype:      0x00000003
8  filetype:        0x0000000A
9  ncmds:           7
10  sizeofcmds:      1848
11  flags:           0x00000000
12  reserved:        0x00000000
13LoadCommands:    
14  - cmd:             LC_UUID
15    cmdsize:         24
16    uuid:            B4D48511-37F4-3ED4-AFA7-1683DCE69AC4
17  - cmd:             LC_SYMTAB
18    cmdsize:         24
19    symoff:          4096
20    nsyms:           2
21    stroff:          4128
22    strsize:         28
23  - cmd:             LC_SEGMENT_64
24    cmdsize:         72
25    segname:         __PAGEZERO
26    vmaddr:          0
27    vmsize:          4294967296
28    fileoff:         0
29    filesize:        0
30    maxprot:         0
31    initprot:        0
32    nsects:          0
33    flags:           0
34  - cmd:             LC_SEGMENT_64
35    cmdsize:         472
36    segname:         __TEXT
37    vmaddr:          4294967296
38    vmsize:          4096
39    fileoff:         0
40    filesize:        0
41    maxprot:         7
42    initprot:        5
43    nsects:          5
44    flags:           0
45    Sections:        
46      - sectname:        __text
47        segname:         __TEXT
48        addr:            0x0000000100000F50
49        size:            52
50        offset:          0x00000000
51        align:           4
52        reloff:          0x00000000
53        nreloc:          0
54        flags:           0x80000400
55        reserved1:       0x00000000
56        reserved2:       0x00000000
57        reserved3:       0x00000000
58      - sectname:        __stubs
59        segname:         __TEXT
60        addr:            0x0000000100000F84
61        size:            6
62        offset:          0x00000000
63        align:           1
64        reloff:          0x00000000
65        nreloc:          0
66        flags:           0x80000408
67        reserved1:       0x00000000
68        reserved2:       0x00000006
69        reserved3:       0x00000000
70      - sectname:        __stub_helper
71        segname:         __TEXT
72        addr:            0x0000000100000F8C
73        size:            26
74        offset:          0x00000000
75        align:           2
76        reloff:          0x00000000
77        nreloc:          0
78        flags:           0x80000400
79        reserved1:       0x00000000
80        reserved2:       0x00000000
81        reserved3:       0x00000000
82      - sectname:        __cstring
83        segname:         __TEXT
84        addr:            0x0000000100000FA6
85        size:            14
86        offset:          0x00000000
87        align:           0
88        reloff:          0x00000000
89        nreloc:          0
90        flags:           0x00000002
91        reserved1:       0x00000000
92        reserved2:       0x00000000
93        reserved3:       0x00000000
94      - sectname:        __unwind_info
95        segname:         __TEXT
96        addr:            0x0000000100000FB4
97        size:            72
98        offset:          0x00000000
99        align:           2
100        reloff:          0x00000000
101        nreloc:          0
102        flags:           0x00000000
103        reserved1:       0x00000000
104        reserved2:       0x00000000
105        reserved3:       0x00000000
106  - cmd:             LC_SEGMENT_64
107    cmdsize:         232
108    segname:         __DATA
109    vmaddr:          4294971392
110    vmsize:          4096
111    fileoff:         0
112    filesize:        0
113    maxprot:         7
114    initprot:        3
115    nsects:          2
116    flags:           0
117    Sections:        
118      - sectname:        __nl_symbol_ptr
119        segname:         __DATA
120        addr:            0x0000000100001000
121        size:            16
122        offset:          0x00000000
123        align:           3
124        reloff:          0x00000000
125        nreloc:          0
126        flags:           0x00000006
127        reserved1:       0x00000001
128        reserved2:       0x00000000
129        reserved3:       0x00000000
130      - sectname:        __la_symbol_ptr
131        segname:         __DATA
132        addr:            0x0000000100001010
133        size:            8
134        offset:          0x00000000
135        align:           3
136        reloff:          0x00000000
137        nreloc:          0
138        flags:           0x00000007
139        reserved1:       0x00000003
140        reserved2:       0x00000000
141        reserved3:       0x00000000
142  - cmd:             LC_SEGMENT_64
143    cmdsize:         72
144    segname:         __LINKEDIT
145    vmaddr:          4294975488
146    vmsize:          4096
147    fileoff:         4096
148    filesize:        60
149    maxprot:         7
150    initprot:        1
151    nsects:          0
152    flags:           0
153  - cmd:             LC_SEGMENT_64
154    cmdsize:         952
155    segname:         __DWARF
156    vmaddr:          4294979584
157    vmsize:          4096
158    fileoff:         8192
159    filesize:        764
160    maxprot:         7
161    initprot:        3
162    nsects:          11
163    flags:           0
164    Sections:        
165      - sectname:        __debug_line
166        segname:         __DWARF
167        addr:            0x0000000100003000
168        size:            69
169        offset:          0x00002000
170        align:           0
171        reloff:          0x00000000
172        nreloc:          0
173        flags:           0x00000000
174        reserved1:       0x00000000
175        reserved2:       0x00000000
176        reserved3:       0x00000000
177      - sectname:        __debug_pubnames
178        segname:         __DWARF
179        addr:            0x0000000100003045
180        size:            27
181        offset:          0x00002045
182        align:           0
183        reloff:          0x00000000
184        nreloc:          0
185        flags:           0x00000000
186        reserved1:       0x00000000
187        reserved2:       0x00000000
188        reserved3:       0x00000000
189      - sectname:        __debug_pubtypes
190        segname:         __DWARF
191        addr:            0x0000000100003060
192        size:            35
193        offset:          0x00002060
194        align:           0
195        reloff:          0x00000000
196        nreloc:          0
197        flags:           0x00000000
198        reserved1:       0x00000000
199        reserved2:       0x00000000
200        reserved3:       0x00000000
201      - sectname:        __debug_aranges
202        segname:         __DWARF
203        addr:            0x0000000100003083
204        size:            48
205        offset:          0x00002083
206        align:           0
207        reloff:          0x00000000
208        nreloc:          0
209        flags:           0x00000000
210        reserved1:       0x00000000
211        reserved2:       0x00000000
212        reserved3:       0x00000000
213      - sectname:        __debug_info
214        segname:         __DWARF
215        addr:            0x00000001000030B3
216        size:            121
217        offset:          0x000020B3
218        align:           0
219        reloff:          0x00000000
220        nreloc:          0
221        flags:           0x00000000
222        reserved1:       0x00000000
223        reserved2:       0x00000000
224        reserved3:       0x00000000
225      - sectname:        __debug_abbrev
226        segname:         __DWARF
227        addr:            0x000000010000312C
228        size:            76
229        offset:          0x0000212C
230        align:           0
231        reloff:          0x00000000
232        nreloc:          0
233        flags:           0x00000000
234        reserved1:       0x00000000
235        reserved2:       0x00000000
236        reserved3:       0x00000000
237      - sectname:        __debug_str
238        segname:         __DWARF
239        addr:            0x0000000100003178
240        size:            142
241        offset:          0x00002178
242        align:           0
243        reloff:          0x00000000
244        nreloc:          0
245        flags:           0x00000000
246        reserved1:       0x00000000
247        reserved2:       0x00000000
248        reserved3:       0x00000000
249      - sectname:        __apple_names
250        segname:         __DWARF
251        addr:            0x0000000100003206
252        size:            60
253        offset:          0x00002206
254        align:           0
255        reloff:          0x00000000
256        nreloc:          0
257        flags:           0x00000000
258        reserved1:       0x00000000
259        reserved2:       0x00000000
260        reserved3:       0x00000000
261      - sectname:        __apple_namespac
262        segname:         __DWARF
263        addr:            0x0000000100003242
264        size:            36
265        offset:          0x00002242
266        align:           0
267        reloff:          0x00000000
268        nreloc:          0
269        flags:           0x00000000
270        reserved1:       0x00000000
271        reserved2:       0x00000000
272        reserved3:       0x00000000
273      - sectname:        __apple_types
274        segname:         __DWARF
275        addr:            0x0000000100003266
276        size:            114
277        offset:          0x00002266
278        align:           0
279        reloff:          0x00000000
280        nreloc:          0
281        flags:           0x00000000
282        reserved1:       0x00000000
283        reserved2:       0x00000000
284        reserved3:       0x00000000
285      - sectname:        __apple_objc
286        segname:         __DWARF
287        addr:            0x00000001000032D8
288        size:            36
289        offset:          0x000022D8
290        align:           0
291        reloff:          0x00000000
292        nreloc:          0
293        flags:           0x00000000
294        reserved1:       0x00000000
295        reserved2:       0x00000000
296        reserved3:       0x00000000
297LinkEditData:    
298  NameList:        
299    - n_strx:          2
300      n_type:          0x0F
301      n_sect:          1
302      n_desc:          16
303      n_value:         4294967296
304    - n_strx:          22
305      n_type:          0x0F
306      n_sect:          1
307      n_desc:          0
308      n_value:         4294971216
309  StringTable:     
310    - ''
311    - ''
312    - __mh_execute_header
313    - _main
314DWARF:           
315  debug_str:       
316    - ''
317    - 'clang version 4.0.0 (trunk 288923) (llvm/trunk 288991)'
318    - hello_world.c
319    - /Users/cbieneman/dev/open-source/llvm-build-rel
320    - main
321    - argc
322    - argv
323    - int
324    - char
325  debug_abbrev:
326    - Table:
327        - Code:            0x00000001
328          Tag:             DW_TAG_compile_unit
329          Children:        DW_CHILDREN_yes
330          Attributes:
331            - Attribute:       DW_AT_producer
332              Form:            DW_FORM_strp
333            - Attribute:       DW_AT_language
334              Form:            DW_FORM_data2
335            - Attribute:       DW_AT_name
336              Form:            DW_FORM_strp
337            - Attribute:       DW_AT_stmt_list
338              Form:            DW_FORM_sec_offset
339            - Attribute:       DW_AT_comp_dir
340              Form:            DW_FORM_strp
341            - Attribute:       DW_AT_low_pc
342              Form:            DW_FORM_addr
343            - Attribute:       DW_AT_high_pc
344              Form:            DW_FORM_data4
345        - Code:            0x00000002
346          Tag:             DW_TAG_subprogram
347          Children:        DW_CHILDREN_yes
348          Attributes:
349            - Attribute:       DW_AT_low_pc
350              Form:            DW_FORM_addr
351            - Attribute:       DW_AT_high_pc
352              Form:            DW_FORM_data4
353            - Attribute:       DW_AT_frame_base
354              Form:            DW_FORM_exprloc
355            - Attribute:       DW_AT_name
356              Form:            DW_FORM_strp
357            - Attribute:       DW_AT_decl_file
358              Form:            DW_FORM_data1
359            - Attribute:       DW_AT_decl_line
360              Form:            DW_FORM_data1
361            - Attribute:       DW_AT_prototyped
362              Form:            DW_FORM_flag_present
363            - Attribute:       DW_AT_type
364              Form:            DW_FORM_ref4
365            - Attribute:       DW_AT_external
366              Form:            DW_FORM_flag_present
367        - Code:            0x00000003
368          Tag:             DW_TAG_formal_parameter
369          Children:        DW_CHILDREN_no
370          Attributes:
371            - Attribute:       DW_AT_location
372              Form:            DW_FORM_exprloc
373            - Attribute:       DW_AT_name
374              Form:            DW_FORM_strp
375            - Attribute:       DW_AT_decl_file
376              Form:            DW_FORM_data1
377            - Attribute:       DW_AT_decl_line
378              Form:            DW_FORM_data1
379            - Attribute:       DW_AT_type
380              Form:            DW_FORM_ref4
381        - Code:            0x00000004
382          Tag:             DW_TAG_base_type
383          Children:        DW_CHILDREN_no
384          Attributes:
385            - Attribute:       DW_AT_name
386              Form:            DW_FORM_strp
387            - Attribute:       DW_AT_encoding
388              Form:            DW_FORM_data1
389            - Attribute:       DW_AT_byte_size
390              Form:            DW_FORM_data1
391        - Code:            0x00000005
392          Tag:             DW_TAG_pointer_type
393          Children:        DW_CHILDREN_no
394          Attributes:
395            - Attribute:       DW_AT_type
396              Form:            DW_FORM_ref4
397  debug_aranges:   
398    - Length:              44
399      Version:             2
400      CuOffset:            0
401      AddressSize:         8
402      SegmentSelectorSize: 0
403      Descriptors:     
404        - Address:         0x0000000100000F50
405          Length:          52
406  debug_pubnames:  
407    Length:          23
408    Version:         2
409    UnitOffset:      0
410    UnitSize:        121
411    Entries:         
412      - DieOffset:       0x0000002A
413        Name:            main
414  debug_pubtypes:  
415    Length:          31
416    Version:         2
417    UnitOffset:      0
418    UnitSize:        121
419    Entries:         
420      - DieOffset:       0x00000060
421        Name:            int
422      - DieOffset:       0x00000071
423        Name:            char
424  debug_info:      
425    - Length:          117
426      Version:         4
427      AbbrOffset:      0
428      AddrSize:        8
429      Entries:         
430        - AbbrCode:        0x00000001
431          Values:          
432            - Value:           0x0000000000000001
433            - Value:           0x000000000000000C
434            - Value:           0x0000000000000038
435            - Value:           0x0000000000000000
436            - Value:           0x0000000000000046
437            - Value:           0x0000000100000F50
438            - Value:           0x0000000000000034
439        - AbbrCode:        0x00000002
440          Values:          
441            - Value:           0x0000000100000F50
442            - Value:           0x0000000000000034
443            - Value:           0x0000000000000001
444              BlockData:       
445                - 0x56
446            - Value:           0x0000000000000076
447            - Value:           0x0000000000000001
448            - Value:           0x0000000000000003
449            - Value:           0x0000000000000001
450            - Value:           0x0000000000000060
451            - Value:           0x0000000000000001
452        - AbbrCode:        0x00000003
453          Values:          
454            - Value:           0x0000000000000002
455              BlockData:       
456                - 0x91
457                - 0x78
458            - Value:           0x000000000000007B
459            - Value:           0x0000000000000001
460            - Value:           0x0000000000000003
461            - Value:           0x0000000000000060
462        - AbbrCode:        0x00000003
463          Values:          
464            - Value:           0x0000000000000002
465              BlockData:       
466                - 0x91
467                - 0x70
468            - Value:           0x0000000000000080
469            - Value:           0x0000000000000001
470            - Value:           0x0000000000000003
471            - Value:           0x0000000000000067
472        - AbbrCode:        0x00000000
473          Values:          
474        - AbbrCode:        0x00000004
475          Values:          
476            - Value:           0x0000000000000085
477            - Value:           0x0000000000000005
478            - Value:           0x0000000000000004
479        - AbbrCode:        0x00000005
480          Values:          
481            - Value:           0x000000000000006C
482        - AbbrCode:        0x00000005
483          Values:          
484            - Value:           0x0000000000000071
485        - AbbrCode:        0x00000004
486          Values:          
487            - Value:           0x0000000000000089
488            - Value:           0x0000000000000006
489            - Value:           0x0000000000000001
490        - AbbrCode:        0x00000000
491          Values:          
492  debug_line:      
493    - Length:          65
494      Version:         2
495      PrologueLength:  36
496      MinInstLength:   1
497      DefaultIsStmt:   1
498      LineBase:        251
499      LineRange:       14
500      OpcodeBase:      13
501      StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
502      Files:           
503        - Name:            hello_world.c
504          DirIdx:          0
505          ModTime:         0
506          Length:          0
507      Opcodes:         
508        - Opcode:          DW_LNS_extended_op
509          ExtLen:          9
510          SubOpcode:       DW_LNE_set_address
511          Data:            4294971216
512        - Opcode:          0x14
513          Data:            4294971216
514        - Opcode:          DW_LNS_set_column
515          Data:            3
516        - Opcode:          DW_LNS_set_prologue_end
517          Data:            3
518        - Opcode:          DW_LNS_const_add_pc
519          Data:            3
520        - Opcode:          0xBB
521          Data:            3
522        - Opcode:          0xBB
523          Data:            3
524        - Opcode:          DW_LNS_advance_pc
525          Data:            11
526        - Opcode:          DW_LNS_extended_op
527          ExtLen:          1
528          SubOpcode:       DW_LNE_end_sequence
529          Data:            11
530...
531
532#      CHECK: debug_line:
533# CHECK-NEXT:   - Length:          65
534# CHECK-NEXT:     Version:         2
535# CHECK-NEXT:     PrologueLength:  36
536# CHECK-NEXT:     MinInstLength:   1
537# CHECK-NEXT:     DefaultIsStmt:   1
538# CHECK-NEXT:     LineBase:        251
539# CHECK-NEXT:     LineRange:       14
540# CHECK-NEXT:     OpcodeBase:      13
541# CHECK-NEXT:     StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
542# CHECK-NEXT:     Files:
543# CHECK-NEXT:       - Name:            hello_world.c
544# CHECK-NEXT:         DirIdx:          0
545# CHECK-NEXT:         ModTime:         0
546# CHECK-NEXT:         Length:          0
547# CHECK-NEXT:     Opcodes:
548# CHECK-NEXT:       - Opcode:          DW_LNS_extended_op
549# CHECK-NEXT:         ExtLen:          9
550# CHECK-NEXT:         SubOpcode:       DW_LNE_set_address
551# CHECK-NEXT:         Data:            4294971216
552# CHECK-NEXT:       - Opcode:          0x14
553# CHECK-NEXT:         Data:            0
554# CHECK-NEXT:       - Opcode:          DW_LNS_set_column
555# CHECK-NEXT:         Data:            3
556# CHECK-NEXT:       - Opcode:          DW_LNS_set_prologue_end
557# CHECK-NEXT:         Data:            0
558# CHECK-NEXT:       - Opcode:          DW_LNS_const_add_pc
559# CHECK-NEXT:         Data:            0
560# CHECK-NEXT:       - Opcode:          0xBB
561# CHECK-NEXT:         Data:            0
562# CHECK-NEXT:       - Opcode:          0xBB
563# CHECK-NEXT:         Data:            0
564# CHECK-NEXT:       - Opcode:          DW_LNS_advance_pc
565# CHECK-NEXT:         Data:            11
566# CHECK-NEXT:       - Opcode:          DW_LNS_extended_op
567# CHECK-NEXT:         ExtLen:          1
568# CHECK-NEXT:         SubOpcode:       DW_LNE_end_sequence
569# CHECK-NEXT:         Data:            0
570# CHECK-NEXT: ...
571