Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / llvm-dwarfdump / X86 / sources.test
blob26eb2117a55fc1f1819683a6f5b9cb54ad0cb9c7
1 # RUN: yaml2obj --docnum=1 %s -o %t.name.o
2 # RUN: llvm-dwarfdump --show-sources %t.name.o | \
3 # RUN:   FileCheck --check-prefix=CU-NAME --match-full-lines \
4 # RUN:     --implicit-check-not={{.}} %s
6 # CU-NAME:      first.c
7 # CU-NAME-NEXT: second.c
9 --- !ELF
10 FileHeader:
11   Class:   ELFCLASS64
12   Data:    ELFDATA2LSB
13   Type:    ET_REL
14   Machine: EM_X86_64
15 DWARF:
16   debug_abbrev:
17     - Table:
18       - Code:     1
19         Tag:      DW_TAG_compile_unit
20         Children: DW_CHILDREN_no
21         Attributes:
22           - Attribute: DW_AT_name
23             Form:      DW_FORM_string
24     - Table:
25       - Code:     1
26         Tag:      DW_TAG_compile_unit
27         Children: DW_CHILDREN_no
28         Attributes:
29           - Attribute: DW_AT_name
30             Form:      DW_FORM_string
31   debug_info:
32     - Version: 4
33       Entries:
34         - AbbrCode: 1
35           Values:
36            - CStr: first.c
37     - Version: 4
38       Entries:
39         - AbbrCode: 1
40           Values:
41            - CStr: second.c
43 # RUN: yaml2obj --docnum=2 %s -o %t.comp-dir.o
44 # RUN: llvm-dwarfdump --show-sources %t.comp-dir.o 2>&1 | \
45 # RUN:   FileCheck -DFILE=%t.comp-dir.o --check-prefix=CU-COMP-DIR \
46 # RUN:     --match-full-lines --implicit-check-not={{.}} %s
48 # CU-COMP-DIR:      warning: [[FILE]]: missing name for compilation unit
49 # CU-COMP-DIR-NEXT: warning: [[FILE]]: missing name for compilation unit
51 --- !ELF
52 FileHeader:
53   Class:   ELFCLASS64
54   Data:    ELFDATA2LSB
55   Type:    ET_REL
56   Machine: EM_X86_64
57 DWARF:
58   debug_abbrev:
59     - Table:
60       - Code:     1
61         Tag:      DW_TAG_compile_unit
62         Children: DW_CHILDREN_no
63         Attributes:
64           - Attribute: DW_AT_comp_dir
65             Form:      DW_FORM_string
66     - Table:
67       - Code:     1
68         Tag:      DW_TAG_compile_unit
69         Children: DW_CHILDREN_no
70         Attributes:
71           - Attribute: DW_AT_comp_dir
72             Form:      DW_FORM_string
73   debug_info:
74     - Version: 4
75       Entries:
76         - AbbrCode: 1
77           Values:
78            - CStr: /comp/first
79     - Version: 4
80       Entries:
81         - AbbrCode: 1
82           Values:
83            - CStr: /comp/second
85 # RUN: yaml2obj --docnum=3 \
86 # RUN:   -DFIRST_NAME=first.c -DFIRST_COMP_DIR=/comp/first \
87 # RUN:   -DSECOND_NAME=second.c -DSECOND_COMP_DIR=/comp/second \
88 # RUN:   -o %t.comp-dir-rel-name.o %s
89 # RUN: llvm-dwarfdump --show-sources %t.comp-dir-rel-name.o | \
90 # RUN:   FileCheck --check-prefix=CU-COMP-DIR-REL-NAME --match-full-lines \
91 # RUN:     --implicit-check-not={{.}} %s
93 # CU-COMP-DIR-REL-NAME:      /comp/first[[SEP:[/\\]]]first.c
94 # CU-COMP-DIR-REL-NAME-NEXT: /comp/second[[SEP]]second.c
96 --- !ELF
97 FileHeader:
98   Class:   ELFCLASS64
99   Data:    ELFDATA2LSB
100   Type:    ET_REL
101   Machine: EM_X86_64
102 DWARF:
103   debug_abbrev:
104     - Table:
105       - Code:     1
106         Tag:      DW_TAG_compile_unit
107         Children: DW_CHILDREN_no
108         Attributes:
109           - Attribute: DW_AT_name
110             Form:      DW_FORM_string
111           - Attribute: DW_AT_comp_dir
112             Form:      DW_FORM_string
113     - Table:
114       - Code:     1
115         Tag:      DW_TAG_compile_unit
116         Children: DW_CHILDREN_no
117         Attributes:
118           - Attribute: DW_AT_name
119             Form:      DW_FORM_string
120           - Attribute: DW_AT_comp_dir
121             Form:      DW_FORM_string
122   debug_info:
123     - Version: 4
124       Entries:
125         - AbbrCode: 1
126           Values:
127            - CStr: [[FIRST_NAME]]
128            - CStr: [[FIRST_COMP_DIR]]
129     - Version: 4
130       Entries:
131         - AbbrCode: 1
132           Values:
133            - CStr: [[SECOND_NAME]]
134            - CStr: [[SECOND_COMP_DIR]]
136 # RUN: yaml2obj --docnum=3 -o %t.comp-dir-abs-name-posix.o \
137 # RUN:   -DFIRST_NAME=/abs/first.c -DFIRST_COMP_DIR=/comp/dir \
138 # RUN:   -DSECOND_NAME=/abs/second.c -DSECOND_COMP_DIR=/comp/dir \
139 # RUN:   %s
140 # RUN: llvm-dwarfdump --show-sources %t.comp-dir-abs-name-posix.o | \
141 # RUN:   FileCheck --check-prefix=CU-COMP-DIR-ABS-NAME-POSIX \
142 # RUN:     --match-full-lines --implicit-check-not={{.}} %s
144 # CU-COMP-DIR-ABS-NAME-POSIX:      /abs/first.c
145 # CU-COMP-DIR-ABS-NAME-POSIX-NEXT: /abs/second.c
147 # RUN: yaml2obj --docnum=3 -o %t.comp-dir-abs-name-windows.o \
148 # RUN:   -DFIRST_NAME='C:\abs\first.c' -DFIRST_COMP_DIR='C:\comp\dir' \
149 # RUN:   -DSECOND_NAME='C:\abs\second.c' -DSECOND_COMP_DIR='C:\comp\dir' \
150 # RUN:   %s
151 # RUN: llvm-dwarfdump --show-sources %t.comp-dir-abs-name-windows.o | \
152 # RUN:   FileCheck --check-prefix=CU-COMP-DIR-ABS-NAME-WINDOWS \
153 # RUN:     --match-full-lines --implicit-check-not={{.}} %s
155 # CU-COMP-DIR-ABS-NAME-WINDOWS:      C:\abs\first.c
156 # CU-COMP-DIR-ABS-NAME-WINDOWS-NEXT: C:\abs\second.c
158 # RUN: yaml2obj --docnum=4 %s -o %t.line-table-abs.o
159 # RUN: llvm-dwarfdump --show-sources %t.line-table-abs.o | \
160 # RUN:   FileCheck --check-prefix=LINE-TABLE-ABS --match-full-lines \
161 # RUN:     --implicit-check-not={{.}} %s
163 # LINE-TABLE-ABS:      /comp/first[[SEP:[/\\]]]first.c
164 # LINE-TABLE-ABS-NEXT: /comp/second[[SEP]]second.c
166 --- !ELF
167 FileHeader:
168   Class:   ELFCLASS64
169   Data:    ELFDATA2LSB
170   Type:    ET_REL
171   Machine: EM_X86_64
172 DWARF:
173   debug_line:
174     - Version:       4
175       MinInstLength: 1
176       MaxOpsPerInst: 1
177       DefaultIsStmt: 1
178       LineBase:      0
179       LineRange:     0
180       OpcodeBase:    1
181       IncludeDirs:   [/comp/first]
182       Files:
183         - Name:    first.c
184           DirIdx:  1
185           ModTime: 0
186           Length:  0
187     - Version:       4
188       MinInstLength: 1
189       MaxOpsPerInst: 1
190       DefaultIsStmt: 1
191       LineBase:      0
192       LineRange:     0
193       OpcodeBase:    1
194       IncludeDirs:   [/comp/second]
195       Files:
196         - Name:    second.c
197           DirIdx:  1
198           ModTime: 0
199           Length:  0
201 # RUN: yaml2obj --docnum=5 %s -o %t.line-table-rel.o
202 # RUN: llvm-dwarfdump --show-sources %t.line-table-rel.o | \
203 # RUN:   FileCheck --check-prefix=LINE-TABLE-REL --match-full-lines \
204 # RUN:     --implicit-check-not={{.}} %s
206 # LINE-TABLE-REL:      first.c
207 # LINE-TABLE-REL-NEXT: second.c
209 --- !ELF
210 FileHeader:
211   Class:   ELFCLASS64
212   Data:    ELFDATA2LSB
213   Type:    ET_REL
214   Machine: EM_X86_64
215 DWARF:
216   debug_line:
217     - Version:       4
218       MinInstLength: 1
219       MaxOpsPerInst: 1
220       DefaultIsStmt: 1
221       LineBase:      0
222       LineRange:     0
223       OpcodeBase:    1
224       Files:
225         - Name:    first.c
226           DirIdx:  0
227           ModTime: 0
228           Length:  0
229     - Version:       4
230       MinInstLength: 1
231       MaxOpsPerInst: 1
232       DefaultIsStmt: 1
233       LineBase:      0
234       LineRange:     0
235       OpcodeBase:    1
236       Files:
237         - Name:    second.c
238           DirIdx:  0
239           ModTime: 0
240           Length:  0
242 # RUN: yaml2obj --docnum=6 %s -o %t.cu-line-table.o
243 # RUN: llvm-dwarfdump --show-sources %t.cu-line-table.o | \
244 # RUN:   FileCheck --check-prefix=CU-LINE-TABLE --match-full-lines \
245 # RUN:     --implicit-check-not={{.}} %s
247 # CU-LINE-TABLE:      /first[[SEP:[/\\]]]first[[SEP]]first.c
248 # CU-LINE-TABLE-NEXT: /second[[SEP]]second[[SEP]]second.c
250 --- !ELF
251 FileHeader:
252   Class:   ELFCLASS64
253   Data:    ELFDATA2LSB
254   Type:    ET_REL
255   Machine: EM_X86_64
256 DWARF:
257   debug_abbrev:
258     - Table:
259       - Code:     1
260         Tag:      DW_TAG_compile_unit
261         Children: DW_CHILDREN_no
262         Attributes:
263           - Attribute: DW_AT_comp_dir
264             Form:      DW_FORM_string
265           - Attribute: DW_AT_stmt_list
266             Form:      DW_FORM_sec_offset
267     - Table:
268       - Code:     1
269         Tag:      DW_TAG_compile_unit
270         Children: DW_CHILDREN_no
271         Attributes:
272           - Attribute: DW_AT_comp_dir
273             Form:      DW_FORM_string
274           - Attribute: DW_AT_stmt_list
275             Form:      DW_FORM_sec_offset
276   debug_info:
277     - Version: 4
278       Entries:
279         - AbbrCode: 1
280           Values:
281            - CStr:  /first
282            - Value: 0
283     - Version: 4
284       Entries:
285         - AbbrCode: 1
286           Values:
287            - CStr:  /second
288            - Value: 0x23
289   debug_line:
290     - Version:       4
291       MinInstLength: 1
292       MaxOpsPerInst: 1
293       DefaultIsStmt: 1
294       LineBase:      0
295       LineRange:     0
296       OpcodeBase:    1
297       IncludeDirs:   [first]
298       Files:
299         - Name:    first.c
300           DirIdx:  1
301           ModTime: 0
302           Length:  0
303     - Version:       4
304       MinInstLength: 1
305       MaxOpsPerInst: 1
306       DefaultIsStmt: 1
307       LineBase:      0
308       LineRange:     0
309       OpcodeBase:    1
310       IncludeDirs:   [second]
311       Files:
312         - Name:    second.c
313           DirIdx:  1
314           ModTime: 0
315           Length:  0
317 # RUN: llvm-dwarfdump --show-sources %t.line-table-rel.o %t.cu-line-table.o | \
318 # RUN:   FileCheck --check-prefix=MULTIPLE-FILES --match-full-lines \
319 # RUN:     --implicit-check-not={{.}} %s
321 # MULTIPLE-FILES:      first.c
322 # MULTIPLE-FILES-NEXT: second.c
323 # MULTIPLE-FILES-NEXT: /first[[SEP:[/\\]]]first[[SEP]]first.c
324 # MULTIPLE-FILES-NEXT: /second[[SEP]]second[[SEP]]second.c
326 # RUN: yaml2obj --docnum=7 %s -o %t.no-filenames.o
327 # RUN: llvm-dwarfdump --show-sources %t.no-filenames.o | count 0
329 --- !ELF
330 FileHeader:
331   Class:   ELFCLASS64
332   Data:    ELFDATA2LSB
333   Type:    ET_REL
334   Machine: EM_X86_64
335 DWARF:
336   debug_line:
337     - Version:       4
338       MinInstLength: 1
339       MaxOpsPerInst: 1
340       DefaultIsStmt: 1
341       LineBase:      0
342       LineRange:     0
343       OpcodeBase:    1
344       IncludeDirs:   []
346 # TODO: Use yaml2obj for this test once it supports DWARFv5 line tables.
347 # RUN: echo '.file 0 "/dir" "dwarfv5.c"' | \
348 # RUN:   llvm-mc -g -dwarf-version=5 -triple x86_64-pc-linux -filetype=obj \
349 # RUN:     -o %t.dwarfv5.o
350 # RUN: llvm-dwarfdump --show-sources %t.dwarfv5.o | \
351 # RUN:   FileCheck --check-prefix=DWARFV5 --match-full-lines \
352 # RUN:     --implicit-check-not={{.}} %s
354 # DWARFV5: /dir{{[/\\]}}dwarfv5.c
356 # RUN: llvm-mc -triple x86_64-pc-linux %S/Inputs/debug_line_malformed.s \
357 # RUN:   -filetype=obj -o %t.malformed.o
358 # RUN: not llvm-dwarfdump --show-sources %t.malformed.o 2>&1 | \
359 # RUN:   FileCheck --check-prefix=MALFORMED --match-full-lines \
360 # RUN:     --implicit-check-not={{.}} %s
362 # MALFORMED: error: parsing line table prologue at offset 0x00000048: unsupported version 0