1 ## This test checks debug info for the case when one compilation unit
2 ## contains a definition of a type and another compilation unit
3 ## contains a definition of the same type. When --garbage-collection
4 ## is enabled the result should contain the original definition in CU1
5 ## and the definition from CU2 should have been removed.
7 # RUN: yaml2obj %s -o %t.o
9 ## Check --odr-deduplication.
10 # RUN: llvm-dwarfutil %t.o %t1
11 # RUN: llvm-dwarfdump -a %t1 | FileCheck %s --check-prefixes=CHECK,CHECK-ODR
14 # RUN: llvm-dwarfutil --odr %t.o %t2
17 ## Check --no-odr alias.
18 # RUN: llvm-dwarfutil --no-odr %t.o %t3
19 # RUN: llvm-dwarfdump -a %t3 | FileCheck %s --check-prefixes=CHECK,CHECK-NOODR
21 ## Check --no-odr-deduplication wins if last.
22 # RUN: llvm-dwarfutil --odr-deduplication --no-odr-deduplication %t.o %t4
25 ## Check --odr-deduplication wins if last.
26 # RUN: llvm-dwarfutil --no-odr-deduplication --odr-deduplication %t.o %t6
47 # CHECK: file format elf64-x86-64
48 # CHECK: .debug_info contents:
50 # CHECK: DW_TAG_compile_unit
51 # CHECK: DW_AT_name{{.*}}"CU1"
53 # CHECK: 0x[[CU1_CLASS1:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class1"
54 # CHECK: DW_TAG_member
55 # CHECK-ODR: DW_AT_type{{.*}}0x00000000[[CU1_CHAR:[0-9a-f]*]] "char"
56 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU1_CHAR:[0-9a-f]*]] "char"
57 # CHECK: DW_AT_name{{.*}}"member1"
59 # CHECK: DW_TAG_member
60 # CHECK-ODR: DW_AT_type{{.*}}0x00000000[[CU1_FLOAT:[0-9a-f]*]] "float"
61 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU1_FLOAT:[0-9a-f]*]] "float"
62 # CHECK: DW_AT_name{{.*}}"member2"
64 # CHECK: 0x[[CU1_INT:[0-9a-f]*]]: DW_TAG_base_type
65 # CHECK: DW_AT_name{{.*}}"int"
67 # CHECK: 0x[[CU1_CHAR]]: DW_TAG_base_type
68 # CHECK: DW_AT_name{{.*}}"char"
70 # CHECK: 0x[[CU1_FLOAT]]: DW_TAG_base_type
71 # CHECK: DW_AT_name{{.*}}"float"
73 # CHECK-ODR: 0x[[CU1_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU1_CLASS1]] "class1"
74 # CHECK-NOODR: 0x[[CU1_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x[[CU1_CLASS1]] "class1"
76 # CHECK: DW_TAG_variable
77 # CHECK: DW_AT_name{{.*}}"var1"
78 # CHECK-ODR: DW_AT_type{{.*}}0x00000000[[CU1_PTR_CLASS1]] "class1 *"
79 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU1_PTR_CLASS1]] "class1 *"
81 # CHECK: DW_TAG_compile_unit
82 # CHECK: DW_AT_name{{.*}}"CU2"
84 # CHECK-ODR-NOT: DW_TAG_class_type
85 # CHECK-ODR-NOT: "class1"
87 # CHECK-ODR: 0x[[CU2_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x00000000[[CU1_CLASS1]] "class1"
89 # CHECK-ODR: DW_TAG_variable
90 # CHECK-ODR: DW_AT_name{{.*}}"var1"
91 # CHECK-ODR: DW_AT_type{{.*}}0x00000000[[CU2_PTR_CLASS1]] "class1 *"
94 # CHECK-NOODR: 0x[[CU2_CLASS1:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class1"
95 # CHECK-NOODR: DW_TAG_member
96 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU2_CHAR:[0-9a-f]*]] "char"
97 # CHECK-NOODR: DW_AT_name{{.*}}"member1"
99 # CHECK-NOODR: DW_TAG_member
100 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU2_FLOAT:[0-9a-f]*]] "float"
101 # CHECK-NOODR: DW_AT_name{{.*}}"member2"
103 # CHECK-NOODR: 0x[[CU2_INT:[0-9a-f]*]]: DW_TAG_base_type
104 # CHECK-NOODR: DW_AT_name{{.*}}"int"
106 # CHECK-NOODR: 0x[[CU2_CHAR]]: DW_TAG_base_type
107 # CHECK-NOODR: DW_AT_name{{.*}}"char"
109 # CHECK-NOODR: 0x[[CU2_FLOAT]]: DW_TAG_base_type
110 # CHECK-NOODR: DW_AT_name{{.*}}"float"
112 # CHECK-NOODR: 0x[[CU2_PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x[[CU2_CLASS1]] "class1"
114 # CHECK-NOODR: DW_TAG_variable
115 # CHECK-NOODR: DW_AT_name{{.*}}"var1"
116 # CHECK-NOODR: DW_AT_type{{.*}}0x[[CU2_PTR_CLASS1]] "class1 *"
127 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
132 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
138 - Tag: DW_TAG_compile_unit
139 Children: DW_CHILDREN_yes
141 - Attribute: DW_AT_producer
143 - Attribute: DW_AT_language
145 - Attribute: DW_AT_name
147 - Attribute: DW_AT_low_pc
149 - Attribute: DW_AT_high_pc
151 - Tag: DW_TAG_class_type
152 Children: DW_CHILDREN_yes
154 - Attribute: DW_AT_name
157 Children: DW_CHILDREN_no
159 - Attribute: DW_AT_type
161 - Attribute: DW_AT_name
163 - Tag: DW_TAG_class_type
164 Children: DW_CHILDREN_no
166 - Attribute: DW_AT_name
168 - Attribute: DW_AT_declaration
169 Form: DW_FORM_flag_present
170 - Tag: DW_TAG_class_type
171 Children: DW_CHILDREN_yes
173 - Attribute: DW_AT_name
175 - Attribute: DW_AT_declaration
176 Form: DW_FORM_flag_present
177 - Tag: DW_TAG_template_type_parameter
178 Children: DW_CHILDREN_no
180 - Attribute: DW_AT_type
182 - Tag: DW_TAG_base_type
183 Children: DW_CHILDREN_no
185 - Attribute: DW_AT_name
187 - Tag: DW_TAG_pointer_type
188 Children: DW_CHILDREN_no
190 - Attribute: DW_AT_type
192 - Tag: DW_TAG_variable
193 Children: DW_CHILDREN_no
195 - Attribute: DW_AT_name
197 - Attribute: DW_AT_const_value
199 - Attribute: DW_AT_type
202 - Tag: DW_TAG_compile_unit
203 Children: DW_CHILDREN_yes
205 - Attribute: DW_AT_producer
207 - Attribute: DW_AT_language
209 - Attribute: DW_AT_name
211 - Attribute: DW_AT_low_pc
213 - Attribute: DW_AT_high_pc
215 - Tag: DW_TAG_class_type
216 Children: DW_CHILDREN_yes
218 - Attribute: DW_AT_name
221 Children: DW_CHILDREN_no
223 - Attribute: DW_AT_type
225 - Attribute: DW_AT_name
227 - Tag: DW_TAG_class_type
228 Children: DW_CHILDREN_no
230 - Attribute: DW_AT_name
232 - Attribute: DW_AT_declaration
233 Form: DW_FORM_flag_present
234 - Tag: DW_TAG_class_type
235 Children: DW_CHILDREN_yes
237 - Attribute: DW_AT_name
239 - Attribute: DW_AT_declaration
240 Form: DW_FORM_flag_present
241 - Tag: DW_TAG_template_type_parameter
242 Children: DW_CHILDREN_no
244 - Attribute: DW_AT_type
246 - Tag: DW_TAG_base_type
247 Children: DW_CHILDREN_no
249 - Attribute: DW_AT_name
251 - Tag: DW_TAG_pointer_type
252 Children: DW_CHILDREN_no
254 - Attribute: DW_AT_type
256 - Tag: DW_TAG_variable
257 Children: DW_CHILDREN_no
259 - Attribute: DW_AT_name
261 - Attribute: DW_AT_const_value
263 - Attribute: DW_AT_type