xref: /llvm-project/bolt/test/X86/dwarf5-types-debug-names.test (revision 6aad62cf5b7f91f4b02266cf72469e2c8e28dbef)
1; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-types-debug-names-main.s   -o %tmain.o
2; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-types-debug-names-helper.s -o %thelper.o
3; RUN: %clang %cflags -gdwarf-5 %tmain.o %thelper.o -o %tmain.exe
4; RUN: llvm-bolt %tmain.exe -o %tmain.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
5; RUN: llvm-dwarfdump --debug-info --debug-names %tmain.exe.bolt > %tlog.txt
6; RUN: cat %tlog.txt | FileCheck -check-prefix=BOLT %s
7
8;; Tests that BOLT correctly generates .debug_names section with two CUs and a local TU.
9
10; BOLT: [[OFFSET:0x[0-9a-f]*]]: Type Unit
11; BOLT: [[OFFSET1:0x[0-9a-f]*]]: Compile Unit
12; BOLT: [[OFFSET2:0x[0-9a-f]*]]: Compile Unit
13
14
15; BOLT: Name Index @ 0x0 {
16; BOLT:   Header {
17; BOLT:     Length: 0xE9
18; BOLT:     Format: DWARF32
19; BOLT:     Version: 5
20; BOLT:     CU count: 2
21; BOLT:     Local TU count: 1
22; BOLT:     Foreign TU count: 0
23; BOLT:     Bucket count: 6
24; BOLT:     Name count: 6
25; BOLT:     Abbreviations table size: 0x29
26; BOLT:     Augmentation: 'BOLT'
27; BOLT:   }
28; BOLT:   Compilation Unit offsets [
29; BOLT:     CU[0]: [[OFFSET1]]
30; BOLT:     CU[1]: [[OFFSET2]]
31; BOLT:   ]
32; BOLT:   Local Type Unit offsets [
33; BOLT:     LocalTU[0]: [[OFFSET]]
34; BOLT:   ]
35; BOLT:   Abbreviations [
36; BOLT:     Abbreviation [[ABBREV:0x[0-9a-f]*]] {
37; BOLT:       Tag: DW_TAG_structure_type
38; BOLT:       DW_IDX_type_unit: DW_FORM_data1
39; BOLT:       DW_IDX_die_offset: DW_FORM_ref4
40; BOLT:       DW_IDX_parent: DW_FORM_flag_present
41; BOLT:     }
42; BOLT:     Abbreviation [[ABBREV1:0x[0-9a-f]*]] {
43; BOLT:       Tag: DW_TAG_subprogram
44; BOLT:       DW_IDX_compile_unit: DW_FORM_data1
45; BOLT:       DW_IDX_die_offset: DW_FORM_ref4
46; BOLT:       DW_IDX_parent: DW_FORM_flag_present
47; BOLT:     }
48; BOLT:     Abbreviation [[ABBREV2:0x[0-9a-f]*]] {
49; BOLT:       Tag: DW_TAG_base_type
50; BOLT:       DW_IDX_compile_unit: DW_FORM_data1
51; BOLT:       DW_IDX_die_offset: DW_FORM_ref4
52; BOLT:       DW_IDX_parent: DW_FORM_flag_present
53; BOLT:     }
54; BOLT:     Abbreviation [[ABBREV3:0x[0-9a-f]*]] {
55; BOLT:       Tag: DW_TAG_base_type
56; BOLT:       DW_IDX_type_unit: DW_FORM_data1
57; BOLT:       DW_IDX_die_offset: DW_FORM_ref4
58; BOLT:       DW_IDX_parent: DW_FORM_flag_present
59; BOLT:     }
60; BOLT:   ]
61; BOLT:   Bucket 0 [
62; BOLT:     Name 1 {
63; BOLT:       Hash: 0xF73809C
64; BOLT:       String: {{.+}} "Foo2a"
65; BOLT:       Entry @ {{.+}} {
66; BOLT:         Abbrev: [[ABBREV]]
67; BOLT:         Tag: DW_TAG_structure_type
68; BOLT:         DW_IDX_type_unit: 0x00
69; BOLT:         DW_IDX_die_offset: 0x00000023
70; BOLT:         DW_IDX_parent: <parent not indexed>
71; BOLT:       }
72; BOLT:     }
73; BOLT:   ]
74; BOLT:   Bucket 1 [
75; BOLT:     Name 2 {
76; BOLT:       Hash: 0xB5063D0B
77; BOLT:       String: {{.+}} "_Z3foov"
78; BOLT:       Entry @ {{.+}} {
79; BOLT:         Abbrev: [[ABBREV1]]
80; BOLT:         Tag: DW_TAG_subprogram
81; BOLT:         DW_IDX_compile_unit: 0x01
82; BOLT:         DW_IDX_die_offset: 0x00000024
83; BOLT:         DW_IDX_parent: <parent not indexed>
84; BOLT:       }
85; BOLT:     }
86; BOLT:   ]
87; BOLT:   Bucket 2 [
88; BOLT:     Name 3 {
89; BOLT:       Hash: 0xB888030
90; BOLT:       String: {{.+}} "int"
91; BOLT:       Entry @ {{.+}} {
92; BOLT:         Abbrev: [[ABBREV2]]
93; BOLT:         Tag: DW_TAG_base_type
94; BOLT:         DW_IDX_compile_unit: 0x01
95; BOLT:         DW_IDX_die_offset: 0x00000040
96; BOLT:         DW_IDX_parent: <parent not indexed>
97; BOLT:       }
98; BOLT:     }
99; BOLT:   ]
100; BOLT:   Bucket 3 [
101; BOLT:     Name 4 {
102; BOLT:       Hash: 0xB887389
103; BOLT:       String: {{.+}} "foo"
104; BOLT:       Entry @ {{.+}} {
105; BOLT:         Abbrev: [[ABBREV1]]
106; BOLT:         Tag: DW_TAG_subprogram
107; BOLT:         DW_IDX_compile_unit: 0x01
108; BOLT:         DW_IDX_die_offset: 0x00000024
109; BOLT:         DW_IDX_parent: <parent not indexed>
110; BOLT:       }
111; BOLT:     }
112; BOLT:   ]
113; BOLT:   Bucket 4 [
114; BOLT:     Name 5 {
115; BOLT:       Hash: 0x7C9A7F6A
116; BOLT:       String: {{.+}} "main"
117; BOLT:       Entry @ {{.+}} {
118; BOLT:         Abbrev: [[ABBREV1]]
119; BOLT:         Tag: DW_TAG_subprogram
120; BOLT:         DW_IDX_compile_unit: 0x00
121; BOLT:         DW_IDX_die_offset: 0x00000024
122; BOLT:         DW_IDX_parent: <parent not indexed>
123; BOLT:       }
124; BOLT:     }
125; BOLT:   ]
126; BOLT:   Bucket 5 [
127; BOLT:     Name 6 {
128; BOLT:       Hash: 0x7C952063
129; BOLT:       String: {{.+}} "char"
130; BOLT:       Entry @ {{.+}} {
131; BOLT:         Abbrev: [[ABBREV3]]
132; BOLT:         Tag: DW_TAG_base_type
133; BOLT:         DW_IDX_type_unit: 0x00
134; BOLT:         DW_IDX_die_offset: 0x00000038
135; BOLT:         DW_IDX_parent: <parent not indexed>
136; BOLT:       }
137; BOLT:     }
138; BOLT:   ]
139; BOLT: }
140