[PGO] Add v2 format compatibility test
[oota-llvm.git] / test / tools / dsymutil / X86 / basic-linking-x86.test
1 RUN: cat %p/../Inputs/basic.macho.x86_64 > %t1
2 RUN: llvm-dsymutil -f -oso-prepend-path=%p/.. %t1
3 RUN: llvm-dwarfdump %t1.dwarf | FileCheck %s
4 RUN: llvm-dsymutil -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
5 RUN: llvm-dwarfdump %t2 | FileCheck %s
6 RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
7 RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
8 RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dsymutil -f -y -o - - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
9 RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dsymutil -f -o - -y - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
10
11 CHECK: file format Mach-O 64-bit x86-64
12
13 CHECK: debug_info contents
14
15 CHECK:  Compile Unit:
16
17 CHECK:  DW_TAG_compile_unit [1] *
18 CHECK:    DW_AT_producer [DW_FORM_strp]     ( .debug_str[0x00000001] = "Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
19 CHECK:    DW_AT_language [DW_FORM_data2]        (DW_LANG_C99)
20 CHECK:    DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000040] = "basic1.c")
21 CHECK:    DW_AT_stmt_list [DW_FORM_data4]   (0x00000000)
22 CHECK:    DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000049] = "/Inputs")
23 CHECK:    DW_AT_low_pc [DW_FORM_addr]       (0x0000000100000ea0)
24 CHECK:    DW_TAG_subprogram [2] *
25 CHECK:    DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000051] = "main")
26 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c")
27 CHECK:      DW_AT_decl_line [DW_FORM_data1]     (23)
28 CHECK:      DW_AT_prototyped [DW_FORM_flag]     (0x01)
29 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0063 => {0x00000063})
30 CHECK:      DW_AT_external [DW_FORM_flag]       (0x01)
31 CHECK:      DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
32 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000ea0)
33 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000ec4)
34 CHECK:      DW_AT_frame_base [DW_FORM_block1]   (<0x01> 56 )
35 CHECK:      DW_TAG_formal_parameter [3]
36 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000056] = "argc")
37 CHECK:        DW_AT_decl_file [DW_FORM_data1]       ("/Inputs{{[/\\]}}basic1.c")
38 CHECK:        DW_AT_decl_line [DW_FORM_data1]   (23)
39 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0063 => {0x00000063})
40 CHECK:        DW_AT_location [DW_FORM_block1]   (<0x02> 91 78 )
41 CHECK:      DW_TAG_formal_parameter [3]
42 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000005b] = "argv")
43 CHECK:        DW_AT_decl_file [DW_FORM_data1]   ("/Inputs{{[/\\]}}basic1.c")
44 CHECK:        DW_AT_decl_line [DW_FORM_data1]   (23)
45 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x006a => {0x0000006a})
46 CHECK:        DW_AT_location [DW_FORM_block1]   (<0x02> 91 70 )
47 CHECK:      NULL
48 CHECK:    DW_TAG_base_type [4]
49 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000060] = "int")
50 CHECK:      DW_AT_encoding [DW_FORM_data1]      (DW_ATE_signed)
51 CHECK:      DW_AT_byte_size [DW_FORM_data1]     (0x04)
52 CHECK:    DW_TAG_pointer_type [5]
53 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x006f => {0x0000006f})
54 CHECK:    DW_TAG_pointer_type [5]
55 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0074 => {0x00000074})
56 CHECK:    DW_TAG_const_type [6]
57 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0079 => {0x00000079})
58 CHECK:    DW_TAG_base_type [4]
59 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000064] = "char")
60 CHECK:      DW_AT_encoding [DW_FORM_data1]      (DW_ATE_signed_char)
61 CHECK:      DW_AT_byte_size [DW_FORM_data1]     (0x01)
62 CHECK:    NULL
63
64 CHECK:  Compile Unit:
65
66 CHECK:  DW_TAG_compile_unit [1] *
67 CHECK:   DW_AT_producer [DW_FORM_strp]     ( .debug_str[0x00000001] = "Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
68 CHECK:   DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000069] = "basic2.c")
69 CHECK:   DW_AT_stmt_list [DW_FORM_data4]   (0x0000003f)
70 CHECK:   DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000049] = "/Inputs")
71 CHECK:   DW_AT_low_pc [DW_FORM_addr]       (0x0000000100000ed0)
72 CHECK:    DW_TAG_base_type [4]
73 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000060] = "int")
74 CHECK:    DW_TAG_variable [7]
75 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000072] = "private_int")
76 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0026 => {0x000000a7})
77 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
78 BASIC:      DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 )
79 ARCHIVE:    DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 )
80 CHECK:    DW_TAG_variable [7]
81 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000007e] = "baz")
82 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0026 => {0x000000a7})
83 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
84 CHECK:      DW_AT_location [DW_FORM_block1] (<0x09> 03 00 10 00 00 01 00 00 00 )
85 CHECK:    DW_TAG_subprogram [2] *
86 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000082] = "foo")
87 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
88 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0026 => {0x000000a7})
89 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000ed0)
90 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000f19)
91 CHECK:      DW_AT_frame_base [DW_FORM_block1]   (<0x01> 56 )
92 CHECK:      DW_TAG_formal_parameter [3]
93 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000086] = "arg")
94 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0026 => {0x000000a7})
95 CHECK:        DW_AT_location [DW_FORM_block1]   (<0x02> 91 7c )
96 CHECK:      NULL
97 CHECK:    DW_TAG_subprogram [8]
98 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000008a] = "inc")
99 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0026 => {0x000000a7})
100 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f20)
101 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000f37)
102 CHECK:      DW_AT_frame_base [DW_FORM_block1]   (<0x01> 56 )
103 CHECK:    NULL
104
105 CHECK:  Compile Unit:
106
107 CHECK:  DW_TAG_compile_unit [1] *
108 CHECK:    DW_AT_producer [DW_FORM_strp]     ( .debug_str[0x00000001] = "Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
109 CHECK:    DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008e] = "basic3.c")
110 CHECK:    DW_AT_stmt_list [DW_FORM_data4]   (0x00000093)
111 CHECK:    DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000049] = "/Inputs")
112 CHECK:    DW_AT_low_pc [DW_FORM_addr]       (0x0000000100000f40)
113 CHECK:    DW_TAG_variable [9]
114 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000097] = "val")
115 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x003c => {0x00000162})
116 CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c")
117 BASIC:      DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 )
118 ARCHIVE:    DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 )
119 CHECK:    DW_TAG_volatile_type [10]
120 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0041 => {0x00000167})
121 CHECK:    DW_TAG_base_type [4]
122 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000060] = "int")
123 CHECK:    DW_TAG_subprogram [2] *
124 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000009b] = "bar")
125 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0041 => {0x00000167})
126 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f40)
127 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000f84)
128 CHECK:      DW_AT_frame_base [DW_FORM_block1]   (<0x01> 56 )
129 CHECK:      DW_TAG_formal_parameter [3]
130 CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000086] = "arg")
131 CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0041 => {0x00000167})
132 CHECK:        DW_AT_location [DW_FORM_block1]   (<0x02> 91 78 )
133 CHECK:      NULL
134 CHECK:    DW_TAG_subprogram [8]
135 CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000008a] = "inc")
136 CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0041 => {0x00000167})
137 CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f90)
138 CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000fa9)
139 CHECK:      DW_AT_frame_base [DW_FORM_block1]   (<0x01> 56 )
140
141 CHECK:    NULL
142
143 CHECK: .debug_loc contents
144 CHECK-NOT: Location
145
146 CHECK:.debug_aranges contents:
147 CHECK-NEXT:Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00
148 CHECK-NEXT:[0x0000000100000ea0 - 0x0000000100000ec4)
149 CHECK-NEXT:Address Range Header: length = 0x0000003c, version = 0x0002, cu_offset = 0x00000081, addr_size = 0x08, seg_size = 0x00
150 CHECK-NEXT:[0x0000000100000ed0 - 0x0000000100000f19)
151 CHECK-NEXT:[0x0000000100000f20 - 0x0000000100000f37)
152 CHECK-NEXT:Address Range Header: length = 0x0000003c, version = 0x0002, cu_offset = 0x00000126, addr_size = 0x08, seg_size = 0x00
153 CHECK-NEXT:[0x0000000100000f40 - 0x0000000100000f84)
154 CHECK-NEXT:[0x0000000100000f90 - 0x0000000100000fa9)
155
156 CHECK: .debug_line contents:
157 CHECK:                Dir  Mod Time   File Len   File Name
158 CHECK-NEXT:                 ---- ---------- ---------- ---------------------------
159 CHECK-NEXT: file_names[  1]    0 0x00000000 0x00000000 basic1.c
160 CHECK: Address            Line   Column File   ISA Discriminator Flags
161 CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
162 CHECK-NEXT: 0x0000000100000ea0     23      0      1   0             0  is_stmt
163 CHECK-NEXT: 0x0000000100000eb6     24      0      1   0             0  is_stmt prologue_end
164 CHECK-NEXT: 0x0000000100000ec4     24      0      1   0             0  is_stmt end_sequence
165
166 CHECK:                 Dir  Mod Time   File Len   File Name
167 CHECK-NEXT:                 ---- ---------- ---------- ---------------------------
168 CHECK-NEXT: file_names[  1]    0 0x00000000 0x00000000 basic2.c
169 CHECK: Address            Line   Column File   ISA Discriminator Flags
170 CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
171 CHECK-NEXT: 0x0000000100000ed0     19      0      1   0             0  is_stmt
172 CHECK-NEXT: 0x0000000100000ee2     20      0      1   0             0  is_stmt prologue_end
173 CHECK-NEXT: 0x0000000100000f19     20      0      1   0             0  is_stmt end_sequence
174 CHECK-NEXT: 0x0000000100000f20     14      0      1   0             0  is_stmt
175 CHECK-NEXT: 0x0000000100000f24     15      0      1   0             0  is_stmt prologue_end
176 CHECK-NEXT: 0x0000000100000f37     15      0      1   0             0  is_stmt end_sequence
177
178 CHECK:                 Dir  Mod Time   File Len   File Name
179 CHECK-NEXT:                 ---- ---------- ---------- ---------------------------
180 CHECK-NEXT: file_names[  1]    0 0x00000000 0x00000000 basic3.c
181 CHECK: Address            Line   Column File   ISA Discriminator Flags
182 CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
183 CHECK-NEXT: 0x0000000100000f40     16      0      1   0             0  is_stmt
184 CHECK-NEXT: 0x0000000100000f4b     17      0      1   0             0  is_stmt prologue_end
185 CHECK-NEXT: 0x0000000100000f58     18      0      1   0             0  is_stmt
186 CHECK-NEXT: 0x0000000100000f6c     19      0      1   0             0  is_stmt
187 CHECK-NEXT: 0x0000000100000f7b     20      0      1   0             0  is_stmt
188 CHECK-NEXT: 0x0000000100000f84     20      0      1   0             0  is_stmt end_sequence
189 CHECK-NEXT: 0x0000000100000f90     11      0      1   0             0  is_stmt
190 CHECK-NEXT: 0x0000000100000f9b     12      0      1   0             0  is_stmt prologue_end
191 CHECK-NEXT: 0x0000000100000fa9     12      0      1   0             0  is_stmt end_sequence
192
193 CHECK: .debug_pubnames contents:
194 CHECK-NEXT: length = 0x00000017 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000081
195 CHECK-NEXT: Offset     Name
196 CHECK-NEXT: 0x00000026 "main"
197 CHECK-NEXT: length = 0x00000036 version = 0x0002 unit_offset = 0x00000081 unit_size = 0x000000a5
198 CHECK-NEXT: Offset     Name
199 CHECK-NEXT: 0x0000002d "private_int"
200 CHECK-NEXT: 0x00000042 "baz"
201 CHECK-NEXT: 0x00000057 "foo"
202 CHECK-NEXT: 0x00000086 "inc"
203 CHECK-NEXT: length = 0x00000026 version = 0x0002 unit_offset = 0x00000126 unit_size = 0x00000096
204 CHECK-NEXT: Offset     Name
205 CHECK-NEXT: 0x00000026 "val"
206 CHECK-NEXT: 0x00000048 "bar"
207 CHECK-NEXT: 0x00000077 "inc"
208
209 CHECK: .debug_pubtypes contents:
210 CHECK-NEXT: length = 0x0000001f version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000081
211 CHECK-NEXT: Offset     Name
212 CHECK-NEXT: 0x00000063 "int"
213 CHECK-NEXT: 0x00000079 "char"
214 CHECK-NEXT: length = 0x00000016 version = 0x0002 unit_offset = 0x00000081 unit_size = 0x000000a5
215 CHECK-NEXT: Offset     Name
216 CHECK-NEXT: 0x00000026 "int"
217 CHECK-NEXT: length = 0x00000016 version = 0x0002 unit_offset = 0x00000126 unit_size = 0x00000096
218 CHECK-NEXT: Offset     Name
219 CHECK-NEXT: 0x00000041 "int"