xref: /llvm-project/llvm/test/tools/llvm-dwarfutil/ELF/X86/gc-no-garbage.test (revision f1fdfe6888f93b9f6dfb4689e1f3206de584ff5b)
1## This test checks that debug info removal optimization (--garbage-collection)
2## does not affect files which do not have dead debug info.
3
4# RUN: yaml2obj %s -o %t.o
5# RUN: llvm-dwarfutil --no-odr --tombstone=maxpc --garbage-collection %t.o - | llvm-dwarfdump -a - | FileCheck %s
6
7# RUN: llvm-dwarfutil --no-odr --linker parallel --tombstone=maxpc --garbage-collection %t.o - | llvm-dwarfdump -a - | FileCheck %s
8
9# CHECK: DW_TAG_compile_unit
10# CHECK: DW_AT_name{{.*}}"CU1"
11# CHECK: DW_TAG_class_type
12# CHECK: DW_AT_name{{.*}}"class1"
13# CHECK: DW_TAG_class_type
14# CHECK: "class2"
15# CHECK: DW_TAG_subprogram
16# CHECK: DW_AT_name{{.*}}"foo1"
17# CHECK: DW_AT_low_pc{{.*}}0x0000000000001000
18# CHECK: DW_AT_high_pc{{.*}}0x0000000000001010
19# CHECK: DW_AT_type{{.*}}"class1"
20# CHECK: DW_TAG_subprogram
21# CHECK: "foo2"
22# CHECK: DW_AT_low_pc{{.*}}0x0000000000001010
23# CHECK: DW_AT_high_pc{{.*}}0x000000000000101b
24# CHECK: DW_AT_type{{.*}}"class2"
25
26
27--- !ELF
28FileHeader:
29  Class:    ELFCLASS64
30  Data:     ELFDATA2LSB
31  Type:     ET_REL
32  Machine:  EM_X86_64
33Sections:
34  - Name:            .text
35    Type:            SHT_PROGBITS
36    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
37    Address:         0x1000
38    Size:            0x1b
39DWARF:
40  debug_abbrev:
41    - Table:
42      - Tag:      DW_TAG_compile_unit
43        Children: DW_CHILDREN_yes
44        Attributes:
45          - Attribute: DW_AT_producer
46            Form:      DW_FORM_string
47          - Attribute: DW_AT_language
48            Form:      DW_FORM_data2
49          - Attribute: DW_AT_name
50            Form:      DW_FORM_string
51          - Attribute: DW_AT_low_pc
52            Form:      DW_FORM_addr
53          - Attribute: DW_AT_high_pc
54            Form:      DW_FORM_data8
55      - Tag:      DW_TAG_subprogram
56        Children: DW_CHILDREN_no
57        Attributes:
58          - Attribute: DW_AT_name
59            Form:      DW_FORM_string
60          - Attribute: DW_AT_low_pc
61            Form:      DW_FORM_addr
62          - Attribute: DW_AT_high_pc
63            Form:      DW_FORM_data8
64          - Attribute: DW_AT_type
65            Form:      DW_FORM_ref4
66      - Tag:      DW_TAG_class_type
67        Children: DW_CHILDREN_yes
68        Attributes:
69          - Attribute: DW_AT_name
70            Form:      DW_FORM_string
71      - Tag:      DW_TAG_member
72        Children: DW_CHILDREN_no
73        Attributes:
74          - Attribute: DW_AT_type
75            Form:      DW_FORM_ref4
76          - Attribute: DW_AT_name
77            Form:      DW_FORM_string
78      - Tag:      DW_TAG_class_type
79        Children: DW_CHILDREN_no
80        Attributes:
81          - Attribute: DW_AT_name
82            Form:      DW_FORM_string
83          - Attribute: DW_AT_declaration
84            Form:      DW_FORM_flag_present
85      - Tag:      DW_TAG_class_type
86        Children: DW_CHILDREN_yes
87        Attributes:
88          - Attribute: DW_AT_name
89            Form:      DW_FORM_string
90          - Attribute: DW_AT_declaration
91            Form:      DW_FORM_flag_present
92      - Tag:      DW_TAG_template_type_parameter
93        Children: DW_CHILDREN_no
94        Attributes:
95          - Attribute: DW_AT_type
96            Form:      DW_FORM_ref4
97      - Tag:      DW_TAG_base_type
98        Children: DW_CHILDREN_no
99        Attributes:
100          - Attribute: DW_AT_name
101            Form:      DW_FORM_string
102  debug_info:
103    - Version: 4
104      Entries:
105        - AbbrCode: 1
106          Values:
107            - CStr: by_hand
108            - Value:  0x04
109            - CStr: CU1
110            - Value:  0x1000
111            - Value:  0x1b
112        - AbbrCode: 3
113          Values:
114            - CStr: class1
115        - AbbrCode: 4
116          Values:
117            - Value:  0x00000056
118            - CStr: member1
119        - AbbrCode: 0
120        - AbbrCode: 3
121          Values:
122            - CStr: class2
123        - AbbrCode: 4
124          Values:
125            - Value:  0x00000056
126            - CStr: member1
127        - AbbrCode: 0
128        - AbbrCode: 8
129          Values:
130            - CStr: int
131        - AbbrCode: 2
132          Values:
133            - CStr: foo1
134            - Value:  0x1000
135            - Value:  0x10
136            - Value:  0x0000002a
137        - AbbrCode: 2
138          Values:
139            - CStr: foo2
140            - Value:  0x1010
141            - Value:  0xb
142            - Value:  0x00000040
143        - AbbrCode: 0
144...
145