xref: /llvm-project/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-macro-short.test (revision f1fdfe6888f93b9f6dfb4689e1f3206de584ff5b)
1## This test checks DWARFv5 DW_MACRO_start_file,
2## DW_MACRO_end_file, DW_MACRO_define, DW_MACRO_undef,
3## DW_MACRO_define_strp, DW_MACRO_undef_strp,
4## DW_MACRO_define_strx, DW_MACRO_undef_strx attributes.
5
6# RUN: yaml2obj %s -o %t.o
7# RUN: llvm-dwarfutil %t.o %t1 2>&1 | FileCheck --check-prefix=WARN %s
8# RUN: llvm-dwarfdump --verify %t1 | FileCheck --check-prefix=VERIFY %s
9# RUN: llvm-dwarfdump -a %t1 | FileCheck %s
10
11# RUN: llvm-dwarfutil --linker parallel %t.o %t1 2>&1 | FileCheck --check-prefix=WARN %s
12# RUN: llvm-dwarfdump --verify %t1 | FileCheck --check-prefix=VERIFY %s
13# RUN: llvm-dwarfdump -a %t1 | FileCheck %s
14
15# WARN: warning: DW_MACRO_define_strx unsupported yet. Convert to DW_MACRO_define_strp.
16# WARN: warning: DW_MACRO_undef_strx unsupported yet. Convert to DW_MACRO_undef_strp.
17# WARN: warning: DW_MACRO_import and DW_MACRO_import_sup are unsupported yet. remove.
18
19# VERIFY: No errors.
20
21##  Content:        "05000003000201004400020144000503000000000604000000000b03000c040007000000000400":
22#
23##  .short  5    # Macro information version
24##  .byte   0    # Flags: 32 bit
25##  .byte   3    # DW_MACRO_start_file
26##  .byte   0    # Line Number
27##  .byte   2    # File Number
28##  .byte   1    # DW_MACRO_define
29##  .byte   0    # Line Number
30##  .asciz  "D"  # Macro String
31##  .byte   2    # DW_MACRO_undef
32##  .byte   1    # Line Number
33##  .asciz  "D"  # Macro String
34##  .byte   5    # DW_MACRO_define_strp
35##  .byte   3    # Line Number
36##  .int  00000000  # Macro String
37##  .byte   6    # DW_MACRO_undef_strp
38##  .byte   4    # Line Number
39##  .int  00000000  # Macro String
40##  .byte   11   # DW_MACRO_define_strx
41##  .byte   3    # Line Number
42##  .byte   00   # Macro String
43##  .byte   12   # DW_MACRO_undef_strx
44##  .byte   4    # Line Number
45##  .byte   00   # Macro String
46##  .byte   7    # DW_MACRO_import
47##  .int    0    # Offset
48##  .byte   4    # DW_MACRO_end_file
49##  .byte   0    # End Of Macro List Mark
50
51#CHECK: .debug_info contents:
52#CHECK:  DW_TAG_compile_unit
53#CHECK:    DW_AT_name        ("CU1")
54#CHECK:    DW_AT_macros  (0x00000000)
55#CHECK: .debug_macro contents:
56#CHECK: 0x00000000:
57#CHECK: DW_MACRO_start_file - lineno: 0 filenum: 2
58#CHECK-NEXT: DW_MACRO_define - lineno: 0 macro: D
59#CHECK-NEXT: DW_MACRO_undef - lineno: 1 macro: D
60#CHECK-NEXT:   DW_MACRO_define_strp - lineno: 3 macro: aa
61#CHECK-NEXT:   DW_MACRO_undef_strp - lineno: 4 macro: aa
62#CHECK-NEXT:   DW_MACRO_define_strp - lineno: 3 macro: aa
63#CHECK-NEXT:   DW_MACRO_undef_strp - lineno: 4 macro: aa
64#CHECK-NEXT: DW_MACRO_end_file
65
66--- !ELF
67FileHeader:
68  Class:    ELFCLASS64
69  Data:     ELFDATA2LSB
70  Type:     ET_REL
71  Machine:  EM_X86_64
72Sections:
73  - Name:            .text
74    Type:            SHT_PROGBITS
75    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
76    Address:         0x1000
77    Size:            0x1b
78  - Name:            .debug_macro
79    Type:            SHT_PROGBITS
80    Flags:           [  ]
81    Content:        "05000003000201004400020144000503000000000604000000000b03000c040007000000000400"
82  - Name:            .debug_str_offsets
83    Type:            SHT_PROGBITS
84    Flags:           [  ]
85    Content:        "080000000500000000000000"
86DWARF:
87  debug_abbrev:
88    - Table:
89      - Tag:      DW_TAG_compile_unit
90        Children: DW_CHILDREN_yes
91        Attributes:
92          - Attribute: DW_AT_producer
93            Form:      DW_FORM_string
94          - Attribute: DW_AT_language
95            Form:      DW_FORM_data2
96          - Attribute: DW_AT_name
97            Form:      DW_FORM_string
98          - Attribute: DW_AT_low_pc
99            Form:      DW_FORM_addr
100          - Attribute: DW_AT_high_pc
101            Form:      DW_FORM_data8
102          - Attribute: DW_AT_macros
103            Form:      DW_FORM_sec_offset
104          - Attribute: DW_AT_str_offsets_base
105            Form:      DW_FORM_sec_offset
106      - Tag:      DW_TAG_class_type
107        Children: DW_CHILDREN_yes
108        Attributes:
109          - Attribute: DW_AT_name
110            Form:      DW_FORM_string
111      - Tag:      DW_TAG_member
112        Children: DW_CHILDREN_no
113        Attributes:
114          - Attribute: DW_AT_type
115            Form:      DW_FORM_ref4
116          - Attribute: DW_AT_name
117            Form:      DW_FORM_string
118      - Tag:      DW_TAG_class_type
119        Children: DW_CHILDREN_no
120        Attributes:
121          - Attribute: DW_AT_name
122            Form:      DW_FORM_string
123          - Attribute: DW_AT_declaration
124            Form:      DW_FORM_flag_present
125      - Tag:      DW_TAG_class_type
126        Children: DW_CHILDREN_yes
127        Attributes:
128          - Attribute: DW_AT_name
129            Form:      DW_FORM_string
130          - Attribute: DW_AT_declaration
131            Form:      DW_FORM_flag_present
132      - Tag:      DW_TAG_template_type_parameter
133        Children: DW_CHILDREN_no
134        Attributes:
135          - Attribute: DW_AT_type
136            Form:      DW_FORM_ref4
137      - Tag:      DW_TAG_base_type
138        Children: DW_CHILDREN_no
139        Attributes:
140          - Attribute: DW_AT_name
141            Form:      DW_FORM_string
142      - Tag:      DW_TAG_pointer_type
143        Children: DW_CHILDREN_no
144        Attributes:
145          - Attribute: DW_AT_type
146            Form:      DW_FORM_ref4
147      - Tag:      DW_TAG_variable
148        Children: DW_CHILDREN_no
149        Attributes:
150          - Attribute: DW_AT_name
151            Form:      DW_FORM_string
152          - Attribute: DW_AT_const_value
153            Form:      DW_FORM_data4
154          - Attribute: DW_AT_type
155            Form:      DW_FORM_ref4
156      - Tag:      DW_TAG_subprogram
157        Children: DW_CHILDREN_no
158        Attributes:
159          - Attribute: DW_AT_name
160            Form:      DW_FORM_string
161          - Attribute: DW_AT_low_pc
162            Form:      DW_FORM_addr
163          - Attribute: DW_AT_high_pc
164            Form:      DW_FORM_data8
165          - Attribute: DW_AT_type
166            Form:      DW_FORM_ref4
167  debug_info:
168    - Version: 5
169      UnitType:   DW_UT_compile
170      Entries:
171        - AbbrCode: 1
172          Values:
173            - CStr: by_hand
174            - Value:  0x04
175            - CStr: CU1
176            - Value:  0x1000
177            - Value:  0x1b
178            - Value:  0x0
179            - Value:  0x8
180        - AbbrCode: 2
181          Values:
182            - CStr: class1
183        - AbbrCode: 3
184          Values:
185            - Value:  0x00000056
186            - CStr: member1
187        - AbbrCode: 3
188          Values:
189            - Value:  0x0000005c
190            - CStr: member2
191        - AbbrCode: 0
192        - AbbrCode: 7
193          Values:
194            - CStr: int
195        - AbbrCode: 7
196          Values:
197            - CStr: char
198        - AbbrCode: 7
199          Values:
200            - CStr: float
201        - AbbrCode: 8
202          Values:
203            - Value:  0x00000033
204        - AbbrCode: 9
205          Values:
206            - CStr: var1
207            - Value:  0x00000000
208            - Value:  0x00000056
209        - AbbrCode: 10
210          Values:
211            - CStr: foo1
212            - Value:  0x1000
213            - Value:  0x10
214            - Value:  0x00000033
215        - AbbrCode: 0
216        - AbbrCode: 0
217  debug_str:
218    - 'aa'
219...
220