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
7 # RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck %s --check-prefix=DWARF32
13 cpusubtype: 0x00000003
45 addr: 0x0000000100000F50
57 addr: 0x0000000100000F84
67 - sectname: __stub_helper
69 addr: 0x0000000100000F8C
81 addr: 0x0000000100000FA6
91 - sectname: __unwind_info
93 addr: 0x0000000100000FB4
100 reserved1: 0x00000000
101 reserved2: 0x00000000
102 reserved3: 0x00000000
115 - sectname: __nl_symbol_ptr
117 addr: 0x0000000100001000
124 reserved1: 0x00000001
125 reserved2: 0x00000000
126 reserved3: 0x00000000
127 - sectname: __la_symbol_ptr
129 addr: 0x0000000100001010
136 reserved1: 0x00000003
137 reserved2: 0x00000000
138 reserved3: 0x00000000
162 - sectname: __debug_line
164 addr: 0x0000000100003000
171 reserved1: 0x00000000
172 reserved2: 0x00000000
173 reserved3: 0x00000000
174 - sectname: __debug_pubnames
176 addr: 0x0000000100003045
183 reserved1: 0x00000000
184 reserved2: 0x00000000
185 reserved3: 0x00000000
186 - sectname: __debug_pubtypes
188 addr: 0x0000000100003060
195 reserved1: 0x00000000
196 reserved2: 0x00000000
197 reserved3: 0x00000000
198 - sectname: __debug_aranges
200 addr: 0x0000000100003083
207 reserved1: 0x00000000
208 reserved2: 0x00000000
209 reserved3: 0x00000000
210 - sectname: __debug_info
212 addr: 0x00000001000030B3
219 reserved1: 0x00000000
220 reserved2: 0x00000000
221 reserved3: 0x00000000
222 - sectname: __debug_abbrev
224 addr: 0x000000010000312C
231 reserved1: 0x00000000
232 reserved2: 0x00000000
233 reserved3: 0x00000000
234 - sectname: __debug_str
236 addr: 0x0000000100003178
243 reserved1: 0x00000000
244 reserved2: 0x00000000
245 reserved3: 0x00000000
246 - sectname: __apple_names
248 addr: 0x0000000100003206
255 reserved1: 0x00000000
256 reserved2: 0x00000000
257 reserved3: 0x00000000
258 - sectname: __apple_namespac
260 addr: 0x0000000100003242
267 reserved1: 0x00000000
268 reserved2: 0x00000000
269 reserved3: 0x00000000
270 - sectname: __apple_types
272 addr: 0x0000000100003266
279 reserved1: 0x00000000
280 reserved2: 0x00000000
281 reserved3: 0x00000000
282 - sectname: __apple_objc
284 addr: 0x00000001000032D8
291 reserved1: 0x00000000
292 reserved2: 0x00000000
293 reserved3: 0x00000000
309 - __mh_execute_header
315 Tag: DW_TAG_compile_unit
316 Children: DW_CHILDREN_yes
318 - Attribute: DW_AT_producer
320 - Attribute: DW_AT_language
322 - Attribute: DW_AT_name
324 - Attribute: DW_AT_stmt_list
325 Form: DW_FORM_sec_offset
326 - Attribute: DW_AT_comp_dir
328 - Attribute: DW_AT_low_pc
330 - Attribute: DW_AT_high_pc
333 Tag: DW_TAG_subprogram
334 Children: DW_CHILDREN_yes
336 - Attribute: DW_AT_low_pc
338 - Attribute: DW_AT_high_pc
340 - Attribute: DW_AT_frame_base
341 Form: DW_FORM_exprloc
342 - Attribute: DW_AT_name
344 - Attribute: DW_AT_decl_file
346 - Attribute: DW_AT_decl_line
348 - Attribute: DW_AT_prototyped
349 Form: DW_FORM_flag_present
350 - Attribute: DW_AT_type
352 - Attribute: DW_AT_external
353 Form: DW_FORM_flag_present
355 Tag: DW_TAG_formal_parameter
356 Children: DW_CHILDREN_no
358 - Attribute: DW_AT_location
359 Form: DW_FORM_exprloc
360 - Attribute: DW_AT_name
362 - Attribute: DW_AT_decl_file
364 - Attribute: DW_AT_decl_line
366 - Attribute: DW_AT_type
369 Tag: DW_TAG_base_type
370 Children: DW_CHILDREN_no
372 - Attribute: DW_AT_name
374 - Attribute: DW_AT_encoding
376 - Attribute: DW_AT_byte_size
379 Tag: DW_TAG_pointer_type
380 Children: DW_CHILDREN_no
382 - Attribute: DW_AT_type
389 SegmentSelectorSize: 0
391 - Address: 0x0000000100000F50
396 UnitType: DW_UT_compile
400 - AbbrCode: 0x00000001
402 - Value: 0x0000000000000001
403 - Value: 0x000000000000000C
404 - Value: 0x0000000000000038
405 - Value: 0x0000000000000000
406 - Value: 0x0000000000000046
407 - Value: 0x0000000100000F50
408 - Value: 0x0000000000000034
409 - AbbrCode: 0x00000002
411 - Value: 0x0000000100000F50
412 - Value: 0x0000000000000034
413 - Value: 0x0000000000000001
416 - Value: 0x0000000000000076
417 - Value: 0x0000000000000001
418 - Value: 0x0000000000000003
419 - Value: 0x0000000000000001
420 - Value: 0x0000000000000060
421 - Value: 0x0000000000000001
422 - AbbrCode: 0x00000003
424 - Value: 0x0000000000000002
428 - Value: 0x000000000000007B
429 - Value: 0x0000000000000001
430 - Value: 0x0000000000000003
431 - Value: 0x0000000000000060
432 - AbbrCode: 0x00000003
434 - Value: 0x0000000000000002
438 - Value: 0x0000000000000080
439 - Value: 0x0000000000000001
440 - Value: 0x0000000000000003
441 - Value: 0x0000000000000067
442 - AbbrCode: 0x00000000
443 - AbbrCode: 0x00000004
445 - Value: 0x0000000000000085
446 - Value: 0x0000000000000005
447 - Value: 0x0000000000000004
448 - AbbrCode: 0x00000005
450 - Value: 0x000000000000006C
451 - AbbrCode: 0x00000005
453 - Value: 0x0000000000000071
454 - AbbrCode: 0x00000004
456 - Value: 0x0000000000000089
457 - Value: 0x0000000000000006
458 - Value: 0x0000000000000001
459 - AbbrCode: 0x00000000
469 StandardOpcodeLengths:
483 - Name: hello_world.c
488 - Opcode: DW_LNS_extended_op
490 SubOpcode: DW_LNE_set_address
494 - Opcode: DW_LNS_set_column
496 - Opcode: DW_LNS_set_prologue_end
498 - Opcode: DW_LNS_const_add_pc
504 - Opcode: DW_LNS_advance_pc
506 - Opcode: DW_LNS_extended_op
508 SubOpcode: DW_LNE_end_sequence
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
600 cpusubtype: 0x00000003
619 - sectname: __debug_abbrev
628 reserved1: 0x00000000
629 reserved2: 0x00000000
630 reserved3: 0x00000000
631 - sectname: __debug_info
640 reserved1: 0x00000000
641 reserved2: 0x00000000
642 reserved3: 0x00000000
647 Tag: DW_TAG_compile_unit
648 Children: DW_CHILDREN_no
650 - Attribute: DW_AT_low_pc
656 UnitType: DW_UT_compile
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