xref: /llvm-project/llvm/test/tools/llvm-dwarfutil/ELF/X86/verify.test (revision ad32576cffc88bf7c359a528afbed7c2ae7ddb2d)
1## This test checks that debug info contained in the source file is properly
2## verified by --verify after copying. If --no-garbage-collection is
3## specified then the verification should fail, otherwise the verification
4## should succeed.
5
6# RUN: yaml2obj %s -o %t.o
7
8## Verify resulting debug info after --garbage-collection optimisation.
9# RUN: llvm-dwarfutil %t.o %t1 --verify
10# RUN: llvm-dwarfutil --linker parallel %t.o %t1 --verify
11
12## Verify separate debug file after --garbage-collection optimisation.
13# RUN: llvm-dwarfutil %t.o --separate-debug-file %t1 --verify
14# RUN: llvm-dwarfutil --linker parallel %t.o --separate-debug-file %t1 --verify
15
16## Verify not optimised resulting debug info.
17# RUN: not llvm-dwarfutil --no-garbage-collection %t.o %t1 --verify 2>&1 | FileCheck %s -DFILE=%t1
18# RUN: not llvm-dwarfutil --linker parallel --no-garbage-collection %t.o %t1 --verify 2>&1 | FileCheck %s -DFILE=%t1
19
20## Verify not optimised resulting separate debug file.
21# RUN: not llvm-dwarfutil --no-garbage-collection %t.o --separate-debug-file %t1 --verify 2>&1 | FileCheck %s -DFILE=%t1.debug
22# RUN: not llvm-dwarfutil --linker parallel --no-garbage-collection %t.o --separate-debug-file %t1 --verify 2>&1 | FileCheck %s -DFILE=%t1.debug
23
24## Check that verification is disabled when destination is stdout.
25# RUN: llvm-dwarfutil %t.o - --verify 2>&1 | FileCheck %s --check-prefix=CHECK-STDOUT
26# RUN: llvm-dwarfutil --linker parallel %t.o - --verify 2>&1 | FileCheck %s --check-prefix=CHECK-STDOUT
27
28# CHECK: error: '[[FILE]]': output verification failed
29# CHECK-STDOUT: warning: verification skipped because writing to stdout
30
31--- !ELF
32FileHeader:
33  Class:    ELFCLASS64
34  Data:     ELFDATA2LSB
35  Type:     ET_REL
36  Machine:  EM_X86_64
37DWARF:
38  debug_abbrev:
39    - Table:
40      - Tag:      DW_TAG_compile_unit
41        Children: DW_CHILDREN_yes
42        Attributes:
43          - Attribute: DW_AT_producer
44            Form:      DW_FORM_string
45          - Attribute: DW_AT_language
46            Form:      DW_FORM_data2
47          - Attribute: DW_AT_name
48            Form:      DW_FORM_string
49          - Attribute: DW_AT_low_pc
50            Form:      DW_FORM_addr
51          - Attribute: DW_AT_high_pc
52            Form:      DW_FORM_data8
53      - Tag:      DW_TAG_subprogram
54        Children: DW_CHILDREN_no
55        Attributes:
56          - Attribute: DW_AT_name
57            Form:      DW_FORM_string
58          - Attribute: DW_AT_low_pc
59            Form:      DW_FORM_addr
60          - Attribute: DW_AT_high_pc
61            Form:      DW_FORM_data8
62          - Attribute: DW_AT_type
63            Form:      DW_FORM_ref4
64      - Tag:      DW_TAG_class_type
65        Children: DW_CHILDREN_yes
66        Attributes:
67          - Attribute: DW_AT_name
68            Form:      DW_FORM_string
69      - Tag:      DW_TAG_member
70        Children: DW_CHILDREN_no
71        Attributes:
72          - Attribute: DW_AT_type
73            Form:      DW_FORM_ref4
74          - Attribute: DW_AT_name
75            Form:      DW_FORM_string
76      - Tag:      DW_TAG_class_type
77        Children: DW_CHILDREN_no
78        Attributes:
79          - Attribute: DW_AT_name
80            Form:      DW_FORM_string
81          - Attribute: DW_AT_declaration
82            Form:      DW_FORM_flag_present
83      - Tag:      DW_TAG_class_type
84        Children: DW_CHILDREN_yes
85        Attributes:
86          - Attribute: DW_AT_name
87            Form:      DW_FORM_string
88          - Attribute: DW_AT_declaration
89            Form:      DW_FORM_flag_present
90      - Tag:      DW_TAG_template_type_parameter
91        Children: DW_CHILDREN_no
92        Attributes:
93          - Attribute: DW_AT_type
94            Form:      DW_FORM_ref4
95      - Tag:      DW_TAG_base_type
96        Children: DW_CHILDREN_no
97        Attributes:
98          - Attribute: DW_AT_name
99            Form:      DW_FORM_string
100  debug_info:
101    - Version: 4
102      Entries:
103        - AbbrCode: 1
104          Values:
105            - CStr: by_hand
106            - Value:  0x04
107            - CStr: CU1
108            - Value:  0x1000
109            - Value:  0x100
110        - AbbrCode: 3
111          Values:
112            - CStr: class1
113        - AbbrCode: 4
114          Values:
115            - Value:  0x0000006c
116            - CStr: member1
117        - AbbrCode: 0
118        - AbbrCode: 3
119          Values:
120            - CStr: class2
121        - AbbrCode: 4
122          Values:
123            - Value:  0x0000006c
124            - CStr: member1
125        - AbbrCode: 0
126        - AbbrCode: 3
127          Values:
128            - CStr: class3
129        - AbbrCode: 4
130          Values:
131            - Value:  0x0000006c
132            - CStr: member1
133        - AbbrCode: 0
134        - AbbrCode: 8
135          Values:
136            - CStr: int
137        - AbbrCode: 2
138          Values:
139            - CStr: foo1
140            - Value:  0x1000
141            - Value:  0x10
142            - Value:  0x0000002a
143        - AbbrCode: 2
144          Values:
145            - CStr: foo2
146            - Value:  0x0
147            - Value:  0x100
148            - Value:  0x00000040
149        - AbbrCode: 2
150          Values:
151            - CStr: foo3
152            - Value:  0x0
153            - Value:  0x80
154            - Value:  0x00000040
155        - AbbrCode: 0
156...
157