xref: /llvm-project/bolt/test/X86/dwarf5-df-types-debug-names.test (revision 6aad62cf5b7f91f4b02266cf72469e2c8e28dbef)
1; RUN: rm -rf %t
2; RUN: mkdir %t
3; RUN: cd %t
4; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-types-debug-names-main.s \
5; RUN: -split-dwarf-file=main.dwo -o main.o
6; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-types-debug-names-helper.s \
7; RUN: -split-dwarf-file=helper.dwo -o helper.o
8; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
9; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
10; RUN: llvm-dwarfdump --debug-info -r 0 main.dwo.dwo > log.txt
11; RUN: llvm-dwarfdump --debug-info -r 0 helper.dwo.dwo >> log.txt
12; RUN: llvm-dwarfdump --debug-info --debug-names main.exe.bolt >> log.txt
13; RUN: cat log.txt | FileCheck -check-prefix=BOLT %s
14
15;; Tests that BOLT correctly generates .debug_names section with two CUs and foreign TUs.
16
17; BOLT: type_signature = [[TYPE:0x[0-9a-f]*]]
18; BOLT: type_signature = [[TYPE1:0x[0-9a-f]*]]
19; BOLT: Compile Unit
20; BOLT: type_signature = [[TYPE2:0x[0-9a-f]*]]
21; BOLT: type_signature = [[TYPE1]]
22; BOLT: Compile Unit
23; BOLT: [[OFFSET:0x[0-9a-f]*]]: Compile Unit
24; BOLT: [[OFFSET1:0x[0-9a-f]*]]: Compile Unit
25
26; BOLT:       Name Index @ 0x0 {
27; BOLT-NEXT:   Header {
28; BOLT-NEXT:     Length: 0x176
29; BOLT-NEXT:     Format: DWARF32
30; BOLT-NEXT:     Version: 5
31; BOLT-NEXT:     CU count: 2
32; BOLT-NEXT:     Local TU count: 0
33; BOLT-NEXT:     Foreign TU count: 3
34; BOLT-NEXT:     Bucket count: 9
35; BOLT-NEXT:     Name count: 9
36; BOLT-NEXT:     Abbreviations table size: 0x37
37; BOLT-NEXT:     Augmentation: 'BOLT'
38; BOLT-NEXT:   }
39; BOLT-NEXT:   Compilation Unit offsets [
40; BOLT-NEXT:     CU[0]: [[OFFSET]]
41; BOLT-NEXT:     CU[1]: [[OFFSET1]]
42; BOLT-NEXT:   ]
43; BOLT-NEXT:   Foreign Type Unit signatures [
44; BOLT-NEXT:     ForeignTU[0]: [[TYPE]]
45; BOLT-NEXT:     ForeignTU[1]: [[TYPE1]]
46; BOLT-NEXT:     ForeignTU[2]: [[TYPE2]]
47; BOLT-NEXT:   ]
48; BOLT-NEXT: Abbreviations [
49; BOLT-NEXT:     Abbreviation [[ABBREV:0x[0-9a-f]*]] {
50; BOLT-NEXT:       Tag: DW_TAG_structure_type
51; BOLT-NEXT:       DW_IDX_type_unit: DW_FORM_data1
52; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
53; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
54; BOLT-NEXT:       DW_IDX_parent: DW_FORM_flag_present
55; BOLT-NEXT:     }
56; BOLT-NEXT:     Abbreviation [[ABBREV1:0x[0-9a-f]*]] {
57; BOLT-NEXT:       Tag: DW_TAG_subprogram
58; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
59; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
60; BOLT-NEXT:       DW_IDX_parent: DW_FORM_flag_present
61; BOLT-NEXT:     }
62; BOLT-NEXT:     Abbreviation [[ABBREV2:0x[0-9a-f]*]] {
63; BOLT-NEXT:       Tag: DW_TAG_variable
64; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
65; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
66; BOLT-NEXT:         DW_IDX_parent: DW_FORM_flag_present
67; BOLT-NEXT:     }
68; BOLT-NEXT:     Abbreviation [[ABBREV3:0x[0-9a-f]*]] {
69; BOLT-NEXT:       Tag: DW_TAG_base_type
70; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
71; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
72; BOLT-NEXT:       DW_IDX_parent: DW_FORM_flag_present
73; BOLT-NEXT:     }
74; BOLT-NEXT:     Abbreviation [[ABBREV4:0x[0-9a-f]*]] {
75; BOLT-NEXT:       Tag: DW_TAG_base_type
76; BOLT-NEXT:       DW_IDX_type_unit: DW_FORM_data1
77; BOLT-NEXT:       DW_IDX_compile_unit: DW_FORM_data1
78; BOLT-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
79; BOLT-NEXT:       DW_IDX_parent: DW_FORM_flag_present
80; BOLT-NEXT:     }
81; BOLT-NEXT:   ]
82; BOLT-NEXT:   Bucket 0 [
83; BOLT-NEXT:     EMPTY
84; BOLT-NEXT:   ]
85; BOLT-NEXT:   Bucket 1 [
86; BOLT-NEXT:     Name 1 {
87; BOLT-NEXT:       Hash: 0x7C96E4DB
88; BOLT-NEXT:       String: {{.+}} "Foo2"
89; BOLT-NEXT:       Entry @ {{.+}} {
90; BOLT-NEXT:         Abbrev: [[ABBREV]]
91; BOLT-NEXT:         Tag: DW_TAG_structure_type
92; BOLT-NEXT:         DW_IDX_type_unit: 0x00
93; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
94; BOLT-NEXT:         DW_IDX_die_offset: 0x00000021
95; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
96; BOLT-NEXT:       }
97; BOLT-NEXT:     }
98; BOLT-NEXT:     Name 2 {
99; BOLT-NEXT:       Hash: 0xB5063D0B
100; BOLT-NEXT:       String: {{.+}} "_Z3foov"
101; BOLT-NEXT:       Entry @ {{.+}} {
102; BOLT-NEXT:         Abbrev: [[ABBREV1]]
103; BOLT-NEXT:         Tag: DW_TAG_subprogram
104; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
105; BOLT-NEXT:         DW_IDX_die_offset: 0x00000029
106; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
107; BOLT-NEXT:       }
108; BOLT-NEXT:     }
109; BOLT-NEXT:     Name 3 {
110; BOLT-NEXT:       Hash: 0xFDE48034
111; BOLT-NEXT:       String: {{.+}} "fooint"
112; BOLT-NEXT:       Entry @ {{.+}} {
113; BOLT-NEXT:         Abbrev: [[ABBREV2]]
114; BOLT-NEXT:         Tag: DW_TAG_variable
115; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
116; BOLT-NEXT:         DW_IDX_die_offset: 0x0000001a
117; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
118; BOLT-NEXT:       }
119; BOLT-NEXT:     }
120; BOLT-NEXT:   ]
121; BOLT-NEXT:   Bucket 2 [
122; BOLT-NEXT:     Name 4 {
123; BOLT-NEXT:       Hash: 0xB888030
124; BOLT-NEXT:       String: {{.+}} "int"
125; BOLT-NEXT:       Entry @ {{.+}} {
126; BOLT-NEXT:         Abbrev: [[ABBREV3]]
127; BOLT-NEXT:         Tag: DW_TAG_base_type
128; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
129; BOLT-NEXT:         DW_IDX_die_offset: 0x00000025
130; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
131; BOLT-NEXT:       }
132; BOLT-NEXT:       Entry @ {{.+}} {
133; BOLT-NEXT:         Abbrev: 0x5
134; BOLT-NEXT:         Tag: DW_TAG_base_type
135; BOLT-NEXT:         DW_IDX_type_unit: 0x02
136; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
137; BOLT-NEXT:         DW_IDX_die_offset: 0x0000003f
138; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
139; BOLT-NEXT:       }
140; BOLT-NEXT:       Entry @ {{.+}} {
141; BOLT-NEXT:         Abbrev: [[ABBREV3]]
142; BOLT-NEXT:         Tag: DW_TAG_base_type
143; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
144; BOLT-NEXT:         DW_IDX_die_offset: 0x00000056
145; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
146; BOLT-NEXT:       }
147; BOLT-NEXT:     }
148; BOLT-NEXT:   ]
149; BOLT-NEXT:   Bucket 3 [
150; BOLT-NEXT:     Name 5 {
151; BOLT-NEXT:       Hash: 0xB887389
152; BOLT-NEXT:       String: {{.+}} "foo"
153; BOLT-NEXT:       Entry @ {{.+}} {
154; BOLT-NEXT:         Abbrev: [[ABBREV1]]
155; BOLT-NEXT:         Tag: DW_TAG_subprogram
156; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
157; BOLT-NEXT:         DW_IDX_die_offset: 0x00000029
158; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
159; BOLT-NEXT:       }
160; BOLT-NEXT:     }
161; BOLT-NEXT:     Name 6 {
162; BOLT-NEXT:       Hash: 0xF73809C
163; BOLT-NEXT:       String: {{.+}} "Foo2a"
164; BOLT-NEXT:       Entry @ {{.+}} {
165; BOLT-NEXT:         Abbrev: [[ABBREV]]
166; BOLT-NEXT:         Tag: DW_TAG_structure_type
167; BOLT-NEXT:         DW_IDX_type_unit: 0x01
168; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
169; BOLT-NEXT:         DW_IDX_die_offset: 0x00000021
170; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
171; BOLT-NEXT:       }
172; BOLT-NEXT:       Entry @ {{.+}} {
173; BOLT-NEXT:         Abbrev: [[ABBREV]]
174; BOLT-NEXT:         Tag: DW_TAG_structure_type
175; BOLT-NEXT:         DW_IDX_type_unit: 0x01
176; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
177; BOLT-NEXT:         DW_IDX_die_offset: 0x00000021
178; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
179; BOLT-NEXT:       }
180; BOLT-NEXT:     }
181; BOLT-NEXT:     Name 7 {
182; BOLT-NEXT:       Hash: 0xBA564846
183; BOLT-NEXT:       String: {{.+}} "Foo2Int"
184; BOLT-NEXT:       Entry @ {{.+}} {
185; BOLT-NEXT:         Abbrev: [[ABBREV]]
186; BOLT-NEXT:         Tag: DW_TAG_structure_type
187; BOLT-NEXT:         DW_IDX_type_unit: 0x02
188; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
189; BOLT-NEXT:         DW_IDX_die_offset: 0x00000021
190; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
191; BOLT-NEXT:       }
192; BOLT-NEXT:     }
193; BOLT-NEXT:   ]
194; BOLT-NEXT:   Bucket 4 [
195; BOLT-NEXT:     EMPTY
196; BOLT-NEXT:   ]
197; BOLT-NEXT:   Bucket 5 [
198; BOLT-NEXT:     EMPTY
199; BOLT-NEXT:   ]
200; BOLT-NEXT:   Bucket 6 [
201; BOLT-NEXT:     EMPTY
202; BOLT-NEXT:   ]
203; BOLT-NEXT:   Bucket 7 [
204; BOLT-NEXT:     Name 8 {
205; BOLT-NEXT:       Hash: 0x7C9A7F6A
206; BOLT-NEXT:       String: {{.+}} "main"
207; BOLT-NEXT:       Entry @ {{.+}} {
208; BOLT-NEXT:         Abbrev: [[ABBREV1]]
209; BOLT-NEXT:         Tag: DW_TAG_subprogram
210; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
211; BOLT-NEXT:         DW_IDX_die_offset: 0x0000001a
212; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
213; BOLT-NEXT:       }
214; BOLT-NEXT:     }
215; BOLT-NEXT:   ]
216; BOLT-NEXT:   Bucket 8 [
217; BOLT-NEXT:     Name 9 {
218; BOLT-NEXT:       Hash: 0x7C952063
219; BOLT-NEXT:       String: {{.+}} "char"
220; BOLT-NEXT:       Entry @ {{.+}} {
221; BOLT-NEXT:         Abbrev: 0x5
222; BOLT-NEXT:         Tag: DW_TAG_base_type
223; BOLT-NEXT:         DW_IDX_type_unit: 0x00
224; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
225; BOLT-NEXT:         DW_IDX_die_offset: 0x00000036
226; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
227; BOLT-NEXT:       }
228; BOLT-NEXT:       Entry @ {{.+}} {
229; BOLT-NEXT:         Abbrev: 0x5
230; BOLT-NEXT:         Tag: DW_TAG_base_type
231; BOLT-NEXT:         DW_IDX_type_unit: 0x01
232; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
233; BOLT-NEXT:         DW_IDX_die_offset: 0x00000048
234; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
235; BOLT-NEXT:       }
236; BOLT-NEXT:       Entry @ {{.+}} {
237; BOLT-NEXT:         Abbrev: 0x5
238; BOLT-NEXT:         Tag: DW_TAG_base_type
239; BOLT-NEXT:         DW_IDX_type_unit: 0x01
240; BOLT-NEXT:         DW_IDX_compile_unit: 0x01
241; BOLT-NEXT:         DW_IDX_die_offset: 0x00000048
242; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
243; BOLT-NEXT:       }
244; BOLT-NEXT:       Entry @ {{.+}} {
245; BOLT-NEXT:         Abbrev: [[ABBREV3]]
246; BOLT-NEXT:         Tag: DW_TAG_base_type
247; BOLT-NEXT:         DW_IDX_compile_unit: 0x00
248; BOLT-NEXT:         DW_IDX_die_offset: 0x00000064
249; BOLT-NEXT:         DW_IDX_parent: <parent not indexed>
250; BOLT-NEXT:       }
251; BOLT-NEXT:     }
252; BOLT-NEXT:   ]
253; BOLT-NEXT: }
254