xref: /llvm-project/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf4-macro-short.test (revision f1fdfe6888f93b9f6dfb4689e1f3206de584ff5b)
1## This test checks DWARFv4 DW_MACINFO_start_file
2## , DW_MACINFO_end_file, DW_MACINFO_define,
3## DW_MACINFO_UNDEF attributes.
4
5# RUN: yaml2obj %s -o %t.o
6# RUN: llvm-dwarfutil %t.o %t1
7# RUN: llvm-dwarfdump --verify %t1 | FileCheck --check-prefix=VERIFY %s
8# RUN: llvm-dwarfdump -a %t1 | FileCheck %s
9
10# RUN: llvm-dwarfutil --linker parallel %t.o %t1
11# RUN: llvm-dwarfdump --verify %t1 | FileCheck --check-prefix=VERIFY %s
12# RUN: llvm-dwarfdump -a %t1 | FileCheck %s
13
14# VERIFY: No errors.
15
16##  Content:        "03000201064400020744000400":
17#
18##  .byte   3    # DW_MACINFO_start_file
19##  .byte   0    # Line Number
20##  .byte   2    # File Number
21##  .byte   1    # DW_MACINFO_define
22##  .byte   6    # Line Number
23##  .asciz  "D"  # Macro String
24##  .byte   2    # DW_MACINFO_undef
25##  .byte   7    # Line Number
26##  .asciz  "D"  # Macro String
27##  .byte   4    # DW_MACINFO_end_file
28##  .byte   0    # End Of Macro List Mark
29
30#CHECK: .debug_info contents:
31#CHECK:  DW_TAG_compile_unit
32#CHECK:    DW_AT_name        ("CU1")
33#CHECK:    DW_AT_macro_info  (0x00000000)
34#CHECK: .debug_macinfo contents:
35#CHECK: 0x00000000:
36#CHECK: DW_MACINFO_start_file - lineno: 0 filenum: 2
37#CHECK:   DW_MACINFO_define - lineno: 6 macro: D
38#CHECK:   DW_MACINFO_undef - lineno: 7 macro: D
39#CHECK: DW_MACINFO_end_file
40
41--- !ELF
42FileHeader:
43  Class:    ELFCLASS64
44  Data:     ELFDATA2LSB
45  Type:     ET_REL
46  Machine:  EM_X86_64
47Sections:
48  - Name:            .text
49    Type:            SHT_PROGBITS
50    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
51    Address:         0x1000
52    Size:            0x1b
53  - Name:            .debug_macinfo
54    Type:            SHT_PROGBITS
55    Flags:           [  ]
56    Content:        "03000201064400020744000400"
57DWARF:
58  debug_abbrev:
59    - Table:
60      - Tag:      DW_TAG_compile_unit
61        Children: DW_CHILDREN_yes
62        Attributes:
63          - Attribute: DW_AT_producer
64            Form:      DW_FORM_string
65          - Attribute: DW_AT_language
66            Form:      DW_FORM_data2
67          - Attribute: DW_AT_name
68            Form:      DW_FORM_string
69          - Attribute: DW_AT_low_pc
70            Form:      DW_FORM_addr
71          - Attribute: DW_AT_high_pc
72            Form:      DW_FORM_data8
73          - Attribute: DW_AT_macro_info
74            Form:      DW_FORM_sec_offset
75      - Tag:      DW_TAG_class_type
76        Children: DW_CHILDREN_yes
77        Attributes:
78          - Attribute: DW_AT_name
79            Form:      DW_FORM_string
80      - Tag:      DW_TAG_member
81        Children: DW_CHILDREN_no
82        Attributes:
83          - Attribute: DW_AT_type
84            Form:      DW_FORM_ref4
85          - Attribute: DW_AT_name
86            Form:      DW_FORM_string
87      - Tag:      DW_TAG_class_type
88        Children: DW_CHILDREN_no
89        Attributes:
90          - Attribute: DW_AT_name
91            Form:      DW_FORM_string
92          - Attribute: DW_AT_declaration
93            Form:      DW_FORM_flag_present
94      - Tag:      DW_TAG_class_type
95        Children: DW_CHILDREN_yes
96        Attributes:
97          - Attribute: DW_AT_name
98            Form:      DW_FORM_string
99          - Attribute: DW_AT_declaration
100            Form:      DW_FORM_flag_present
101      - Tag:      DW_TAG_template_type_parameter
102        Children: DW_CHILDREN_no
103        Attributes:
104          - Attribute: DW_AT_type
105            Form:      DW_FORM_ref4
106      - Tag:      DW_TAG_base_type
107        Children: DW_CHILDREN_no
108        Attributes:
109          - Attribute: DW_AT_name
110            Form:      DW_FORM_string
111      - Tag:      DW_TAG_pointer_type
112        Children: DW_CHILDREN_no
113        Attributes:
114          - Attribute: DW_AT_type
115            Form:      DW_FORM_ref4
116      - Tag:      DW_TAG_variable
117        Children: DW_CHILDREN_no
118        Attributes:
119          - Attribute: DW_AT_name
120            Form:      DW_FORM_string
121          - Attribute: DW_AT_const_value
122            Form:      DW_FORM_data4
123          - Attribute: DW_AT_type
124            Form:      DW_FORM_ref4
125      - Tag:      DW_TAG_subprogram
126        Children: DW_CHILDREN_no
127        Attributes:
128          - Attribute: DW_AT_name
129            Form:      DW_FORM_string
130          - Attribute: DW_AT_low_pc
131            Form:      DW_FORM_addr
132          - Attribute: DW_AT_high_pc
133            Form:      DW_FORM_data8
134          - Attribute: DW_AT_type
135            Form:      DW_FORM_ref4
136  debug_info:
137    - Version: 4
138      Entries:
139        - AbbrCode: 1
140          Values:
141            - CStr: by_hand
142            - Value:  0x04
143            - CStr: CU1
144            - Value:  0x1000
145            - Value:  0x1b
146            - Value:  0x0
147        - AbbrCode: 2
148          Values:
149            - CStr: class1
150        - AbbrCode: 3
151          Values:
152            - Value:  0x00000051
153            - CStr: member1
154        - AbbrCode: 3
155          Values:
156            - Value:  0x00000056
157            - CStr: member2
158        - AbbrCode: 0
159        - AbbrCode: 7
160          Values:
161            - CStr: int
162        - AbbrCode: 7
163          Values:
164            - CStr: char
165        - AbbrCode: 7
166          Values:
167            - CStr: float
168        - AbbrCode: 8
169          Values:
170            - Value:  0x0000002a
171        - AbbrCode: 9
172          Values:
173            - CStr: var1
174            - Value:  0x00000000
175            - Value:  0x00000051
176        - AbbrCode: 10
177          Values:
178            - CStr: foo1
179            - Value:  0x1000
180            - Value:  0x10
181            - Value:  0x0000002e
182        - AbbrCode: 0
183        - AbbrCode: 0
184...
185