xref: /llvm-project/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-macro-short.test (revision f1fdfe6888f93b9f6dfb4689e1f3206de584ff5b)
111e05005SAlexey Lapshin## This test checks DWARFv5 DW_MACRO_start_file,
211e05005SAlexey Lapshin## DW_MACRO_end_file, DW_MACRO_define, DW_MACRO_undef,
311e05005SAlexey Lapshin## DW_MACRO_define_strp, DW_MACRO_undef_strp,
411e05005SAlexey Lapshin## DW_MACRO_define_strx, DW_MACRO_undef_strx attributes.
511e05005SAlexey Lapshin
611e05005SAlexey Lapshin# RUN: yaml2obj %s -o %t.o
711e05005SAlexey Lapshin# RUN: llvm-dwarfutil %t.o %t1 2>&1 | FileCheck --check-prefix=WARN %s
811e05005SAlexey Lapshin# RUN: llvm-dwarfdump --verify %t1 | FileCheck --check-prefix=VERIFY %s
911e05005SAlexey Lapshin# RUN: llvm-dwarfdump -a %t1 | FileCheck %s
1011e05005SAlexey Lapshin
11*f1fdfe68SAlexey Lapshin# RUN: llvm-dwarfutil --linker parallel %t.o %t1 2>&1 | FileCheck --check-prefix=WARN %s
125f2a7fa6SAlexey Lapshin# RUN: llvm-dwarfdump --verify %t1 | FileCheck --check-prefix=VERIFY %s
135f2a7fa6SAlexey Lapshin# RUN: llvm-dwarfdump -a %t1 | FileCheck %s
145f2a7fa6SAlexey Lapshin
1511e05005SAlexey Lapshin# WARN: warning: DW_MACRO_define_strx unsupported yet. Convert to DW_MACRO_define_strp.
1611e05005SAlexey Lapshin# WARN: warning: DW_MACRO_undef_strx unsupported yet. Convert to DW_MACRO_undef_strp.
1711e05005SAlexey Lapshin# WARN: warning: DW_MACRO_import and DW_MACRO_import_sup are unsupported yet. remove.
1811e05005SAlexey Lapshin
1911e05005SAlexey Lapshin# VERIFY: No errors.
2011e05005SAlexey Lapshin
2111e05005SAlexey Lapshin##  Content:        "05000003000201004400020144000503000000000604000000000b03000c040007000000000400":
2211e05005SAlexey Lapshin#
2311e05005SAlexey Lapshin##  .short  5    # Macro information version
2411e05005SAlexey Lapshin##  .byte   0    # Flags: 32 bit
2511e05005SAlexey Lapshin##  .byte   3    # DW_MACRO_start_file
2611e05005SAlexey Lapshin##  .byte   0    # Line Number
2711e05005SAlexey Lapshin##  .byte   2    # File Number
2811e05005SAlexey Lapshin##  .byte   1    # DW_MACRO_define
2911e05005SAlexey Lapshin##  .byte   0    # Line Number
3011e05005SAlexey Lapshin##  .asciz  "D"  # Macro String
3111e05005SAlexey Lapshin##  .byte   2    # DW_MACRO_undef
3211e05005SAlexey Lapshin##  .byte   1    # Line Number
3311e05005SAlexey Lapshin##  .asciz  "D"  # Macro String
3411e05005SAlexey Lapshin##  .byte   5    # DW_MACRO_define_strp
3511e05005SAlexey Lapshin##  .byte   3    # Line Number
3611e05005SAlexey Lapshin##  .int  00000000  # Macro String
3711e05005SAlexey Lapshin##  .byte   6    # DW_MACRO_undef_strp
3811e05005SAlexey Lapshin##  .byte   4    # Line Number
3911e05005SAlexey Lapshin##  .int  00000000  # Macro String
4011e05005SAlexey Lapshin##  .byte   11   # DW_MACRO_define_strx
4111e05005SAlexey Lapshin##  .byte   3    # Line Number
4211e05005SAlexey Lapshin##  .byte   00   # Macro String
4311e05005SAlexey Lapshin##  .byte   12   # DW_MACRO_undef_strx
4411e05005SAlexey Lapshin##  .byte   4    # Line Number
4511e05005SAlexey Lapshin##  .byte   00   # Macro String
4611e05005SAlexey Lapshin##  .byte   7    # DW_MACRO_import
4711e05005SAlexey Lapshin##  .int    0    # Offset
4811e05005SAlexey Lapshin##  .byte   4    # DW_MACRO_end_file
4911e05005SAlexey Lapshin##  .byte   0    # End Of Macro List Mark
5011e05005SAlexey Lapshin
5111e05005SAlexey Lapshin#CHECK: .debug_info contents:
5211e05005SAlexey Lapshin#CHECK:  DW_TAG_compile_unit
5311e05005SAlexey Lapshin#CHECK:    DW_AT_name        ("CU1")
5411e05005SAlexey Lapshin#CHECK:    DW_AT_macros  (0x00000000)
5511e05005SAlexey Lapshin#CHECK: .debug_macro contents:
5611e05005SAlexey Lapshin#CHECK: 0x00000000:
5711e05005SAlexey Lapshin#CHECK: DW_MACRO_start_file - lineno: 0 filenum: 2
5811e05005SAlexey Lapshin#CHECK-NEXT: DW_MACRO_define - lineno: 0 macro: D
5911e05005SAlexey Lapshin#CHECK-NEXT: DW_MACRO_undef - lineno: 1 macro: D
6011e05005SAlexey Lapshin#CHECK-NEXT:   DW_MACRO_define_strp - lineno: 3 macro: aa
6111e05005SAlexey Lapshin#CHECK-NEXT:   DW_MACRO_undef_strp - lineno: 4 macro: aa
6211e05005SAlexey Lapshin#CHECK-NEXT:   DW_MACRO_define_strp - lineno: 3 macro: aa
6311e05005SAlexey Lapshin#CHECK-NEXT:   DW_MACRO_undef_strp - lineno: 4 macro: aa
6411e05005SAlexey Lapshin#CHECK-NEXT: DW_MACRO_end_file
6511e05005SAlexey Lapshin
6611e05005SAlexey Lapshin--- !ELF
6711e05005SAlexey LapshinFileHeader:
6811e05005SAlexey Lapshin  Class:    ELFCLASS64
6911e05005SAlexey Lapshin  Data:     ELFDATA2LSB
7011e05005SAlexey Lapshin  Type:     ET_REL
7111e05005SAlexey Lapshin  Machine:  EM_X86_64
7211e05005SAlexey LapshinSections:
7311e05005SAlexey Lapshin  - Name:            .text
7411e05005SAlexey Lapshin    Type:            SHT_PROGBITS
7511e05005SAlexey Lapshin    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
7611e05005SAlexey Lapshin    Address:         0x1000
7711e05005SAlexey Lapshin    Size:            0x1b
7811e05005SAlexey Lapshin  - Name:            .debug_macro
7911e05005SAlexey Lapshin    Type:            SHT_PROGBITS
8011e05005SAlexey Lapshin    Flags:           [  ]
8111e05005SAlexey Lapshin    Content:        "05000003000201004400020144000503000000000604000000000b03000c040007000000000400"
8211e05005SAlexey Lapshin  - Name:            .debug_str_offsets
8311e05005SAlexey Lapshin    Type:            SHT_PROGBITS
8411e05005SAlexey Lapshin    Flags:           [  ]
8511e05005SAlexey Lapshin    Content:        "080000000500000000000000"
8611e05005SAlexey LapshinDWARF:
8711e05005SAlexey Lapshin  debug_abbrev:
8811e05005SAlexey Lapshin    - Table:
8911e05005SAlexey Lapshin      - Tag:      DW_TAG_compile_unit
9011e05005SAlexey Lapshin        Children: DW_CHILDREN_yes
9111e05005SAlexey Lapshin        Attributes:
9211e05005SAlexey Lapshin          - Attribute: DW_AT_producer
9311e05005SAlexey Lapshin            Form:      DW_FORM_string
9411e05005SAlexey Lapshin          - Attribute: DW_AT_language
9511e05005SAlexey Lapshin            Form:      DW_FORM_data2
9611e05005SAlexey Lapshin          - Attribute: DW_AT_name
9711e05005SAlexey Lapshin            Form:      DW_FORM_string
9811e05005SAlexey Lapshin          - Attribute: DW_AT_low_pc
9911e05005SAlexey Lapshin            Form:      DW_FORM_addr
10011e05005SAlexey Lapshin          - Attribute: DW_AT_high_pc
10111e05005SAlexey Lapshin            Form:      DW_FORM_data8
10211e05005SAlexey Lapshin          - Attribute: DW_AT_macros
10311e05005SAlexey Lapshin            Form:      DW_FORM_sec_offset
10411e05005SAlexey Lapshin          - Attribute: DW_AT_str_offsets_base
10511e05005SAlexey Lapshin            Form:      DW_FORM_sec_offset
10611e05005SAlexey Lapshin      - Tag:      DW_TAG_class_type
10711e05005SAlexey Lapshin        Children: DW_CHILDREN_yes
10811e05005SAlexey Lapshin        Attributes:
10911e05005SAlexey Lapshin          - Attribute: DW_AT_name
11011e05005SAlexey Lapshin            Form:      DW_FORM_string
11111e05005SAlexey Lapshin      - Tag:      DW_TAG_member
11211e05005SAlexey Lapshin        Children: DW_CHILDREN_no
11311e05005SAlexey Lapshin        Attributes:
11411e05005SAlexey Lapshin          - Attribute: DW_AT_type
11511e05005SAlexey Lapshin            Form:      DW_FORM_ref4
11611e05005SAlexey Lapshin          - Attribute: DW_AT_name
11711e05005SAlexey Lapshin            Form:      DW_FORM_string
11811e05005SAlexey Lapshin      - Tag:      DW_TAG_class_type
11911e05005SAlexey Lapshin        Children: DW_CHILDREN_no
12011e05005SAlexey Lapshin        Attributes:
12111e05005SAlexey Lapshin          - Attribute: DW_AT_name
12211e05005SAlexey Lapshin            Form:      DW_FORM_string
12311e05005SAlexey Lapshin          - Attribute: DW_AT_declaration
12411e05005SAlexey Lapshin            Form:      DW_FORM_flag_present
12511e05005SAlexey Lapshin      - Tag:      DW_TAG_class_type
12611e05005SAlexey Lapshin        Children: DW_CHILDREN_yes
12711e05005SAlexey Lapshin        Attributes:
12811e05005SAlexey Lapshin          - Attribute: DW_AT_name
12911e05005SAlexey Lapshin            Form:      DW_FORM_string
13011e05005SAlexey Lapshin          - Attribute: DW_AT_declaration
13111e05005SAlexey Lapshin            Form:      DW_FORM_flag_present
13211e05005SAlexey Lapshin      - Tag:      DW_TAG_template_type_parameter
13311e05005SAlexey Lapshin        Children: DW_CHILDREN_no
13411e05005SAlexey Lapshin        Attributes:
13511e05005SAlexey Lapshin          - Attribute: DW_AT_type
13611e05005SAlexey Lapshin            Form:      DW_FORM_ref4
13711e05005SAlexey Lapshin      - Tag:      DW_TAG_base_type
13811e05005SAlexey Lapshin        Children: DW_CHILDREN_no
13911e05005SAlexey Lapshin        Attributes:
14011e05005SAlexey Lapshin          - Attribute: DW_AT_name
14111e05005SAlexey Lapshin            Form:      DW_FORM_string
14211e05005SAlexey Lapshin      - Tag:      DW_TAG_pointer_type
14311e05005SAlexey Lapshin        Children: DW_CHILDREN_no
14411e05005SAlexey Lapshin        Attributes:
14511e05005SAlexey Lapshin          - Attribute: DW_AT_type
14611e05005SAlexey Lapshin            Form:      DW_FORM_ref4
14711e05005SAlexey Lapshin      - Tag:      DW_TAG_variable
14811e05005SAlexey Lapshin        Children: DW_CHILDREN_no
14911e05005SAlexey Lapshin        Attributes:
15011e05005SAlexey Lapshin          - Attribute: DW_AT_name
15111e05005SAlexey Lapshin            Form:      DW_FORM_string
15211e05005SAlexey Lapshin          - Attribute: DW_AT_const_value
15311e05005SAlexey Lapshin            Form:      DW_FORM_data4
15411e05005SAlexey Lapshin          - Attribute: DW_AT_type
15511e05005SAlexey Lapshin            Form:      DW_FORM_ref4
15611e05005SAlexey Lapshin      - Tag:      DW_TAG_subprogram
15711e05005SAlexey Lapshin        Children: DW_CHILDREN_no
15811e05005SAlexey Lapshin        Attributes:
15911e05005SAlexey Lapshin          - Attribute: DW_AT_name
16011e05005SAlexey Lapshin            Form:      DW_FORM_string
16111e05005SAlexey Lapshin          - Attribute: DW_AT_low_pc
16211e05005SAlexey Lapshin            Form:      DW_FORM_addr
16311e05005SAlexey Lapshin          - Attribute: DW_AT_high_pc
16411e05005SAlexey Lapshin            Form:      DW_FORM_data8
16511e05005SAlexey Lapshin          - Attribute: DW_AT_type
16611e05005SAlexey Lapshin            Form:      DW_FORM_ref4
16711e05005SAlexey Lapshin  debug_info:
16811e05005SAlexey Lapshin    - Version: 5
16911e05005SAlexey Lapshin      UnitType:   DW_UT_compile
17011e05005SAlexey Lapshin      Entries:
17111e05005SAlexey Lapshin        - AbbrCode: 1
17211e05005SAlexey Lapshin          Values:
17311e05005SAlexey Lapshin            - CStr: by_hand
17411e05005SAlexey Lapshin            - Value:  0x04
17511e05005SAlexey Lapshin            - CStr: CU1
17611e05005SAlexey Lapshin            - Value:  0x1000
17711e05005SAlexey Lapshin            - Value:  0x1b
17811e05005SAlexey Lapshin            - Value:  0x0
17911e05005SAlexey Lapshin            - Value:  0x8
18011e05005SAlexey Lapshin        - AbbrCode: 2
18111e05005SAlexey Lapshin          Values:
18211e05005SAlexey Lapshin            - CStr: class1
18311e05005SAlexey Lapshin        - AbbrCode: 3
18411e05005SAlexey Lapshin          Values:
18511e05005SAlexey Lapshin            - Value:  0x00000056
18611e05005SAlexey Lapshin            - CStr: member1
18711e05005SAlexey Lapshin        - AbbrCode: 3
18811e05005SAlexey Lapshin          Values:
18911e05005SAlexey Lapshin            - Value:  0x0000005c
19011e05005SAlexey Lapshin            - CStr: member2
19111e05005SAlexey Lapshin        - AbbrCode: 0
19211e05005SAlexey Lapshin        - AbbrCode: 7
19311e05005SAlexey Lapshin          Values:
19411e05005SAlexey Lapshin            - CStr: int
19511e05005SAlexey Lapshin        - AbbrCode: 7
19611e05005SAlexey Lapshin          Values:
19711e05005SAlexey Lapshin            - CStr: char
19811e05005SAlexey Lapshin        - AbbrCode: 7
19911e05005SAlexey Lapshin          Values:
20011e05005SAlexey Lapshin            - CStr: float
20111e05005SAlexey Lapshin        - AbbrCode: 8
20211e05005SAlexey Lapshin          Values:
20311e05005SAlexey Lapshin            - Value:  0x00000033
20411e05005SAlexey Lapshin        - AbbrCode: 9
20511e05005SAlexey Lapshin          Values:
20611e05005SAlexey Lapshin            - CStr: var1
20711e05005SAlexey Lapshin            - Value:  0x00000000
20811e05005SAlexey Lapshin            - Value:  0x00000056
20911e05005SAlexey Lapshin        - AbbrCode: 10
21011e05005SAlexey Lapshin          Values:
21111e05005SAlexey Lapshin            - CStr: foo1
21211e05005SAlexey Lapshin            - Value:  0x1000
21311e05005SAlexey Lapshin            - Value:  0x10
21411e05005SAlexey Lapshin            - Value:  0x00000033
21511e05005SAlexey Lapshin        - AbbrCode: 0
21611e05005SAlexey Lapshin        - AbbrCode: 0
21711e05005SAlexey Lapshin  debug_str:
21811e05005SAlexey Lapshin    - 'aa'
21911e05005SAlexey Lapshin...
220