1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc
3# RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug
4# RUN: llvm-pdbutil dump -il %t.pdb | FileCheck %s
5
6# The assembly was hand written to model the following C code. As of this
7# writing, clang does not emit extra files for inlinees, so it had to be hand
8# written.
9
10# // t1.h:
11# ++x;
12# #include "t2.h"
13# ++x;
14
15# // t2.h:
16# ++x;
17# __debugbreak();
18# ++x;
19
20# // t.c:
21# volatile int x;
22# static __forceinline void inlinee_1(void) {
23#   ++x;
24# #include "t1.inc"
25#   ++x;
26# }
27# int main() {
28#   ++x;
29#   inlinee_1();
30#   ++x;
31#   return x;
32# }
33
34# CHECK:                             Inlinee Lines
35# CHECK:      Mod 0000 | `{{.*}}pdb-inlinees-extrafiles.s.tmp.obj`:
36# CHECK-NEXT:  Inlinee |  Line | Source File
37# CHECK-NEXT:   0x1000 |     7 | C:\src\llvm-project\build\t.c (MD5: A79D837C976E9F0463A474D74E2EE9E7)
38# CHECK-NEXT:                    C:\src\llvm-project\build\t1.h (MD5: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
39# CHECK-NEXT:                    C:\src\llvm-project\build\t2.h (MD5: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
40
41	.text
42	.def	 @feat.00;
43	.scl	3;
44	.type	0;
45	.endef
46	.globl	@feat.00
47.set @feat.00, 0
48	.intel_syntax noprefix
49	.file	"t.c"
50	.def	 main;
51	.scl	2;
52	.type	32;
53	.endef
54	.section	.text,"xr",one_only,main
55	.globl	main                    # -- Begin function main
56main:                                   # @main
57.Lfunc_begin0:
58	.cv_func_id 0
59# %bb.0:                                # %entry
60	.cv_file	1 "C:\\src\\llvm-project\\build\\t.c" "A79D837C976E9F0463A474D74E2EE9E7" 1
61	.cv_file	2 "C:\\src\\llvm-project\\build\\t1.h" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 1
62	.cv_file	3 "C:\\src\\llvm-project\\build\\t2.h" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 1
63	.cv_loc	0 1 13 0                # t.c:13:0
64	inc	dword ptr [rip + x]
65.Ltmp0:
66	.cv_inline_site_id 1 within 0 inlined_at 1 14 0
67	.cv_loc	1 1 3 0                 # t.c:3:0
68	inc	dword ptr [rip + x]
69.Ltmp1:
70	.cv_loc	1 2 1 0                 # t1.h:1:0
71	inc	dword ptr [rip + x]
72	.cv_loc	1 3 1 0                 # t2.h:1:0
73	inc	dword ptr [rip + x]
74	.cv_loc	1 3 2 0                 # t2.h:2:0
75	int3
76	.cv_loc	1 3 3 0                 # t2.h:3:0
77	inc	dword ptr [rip + x]
78	.cv_loc	1 2 3 0                 # t1.h:3:0
79	inc	dword ptr [rip + x]
80.Ltmp2:
81	.cv_loc	1 1 5 0                # t.c:5:0
82	inc	dword ptr [rip + x]
83.Ltmp3:
84	.cv_loc	0 1 15 0                # t.c:15:0
85	inc	dword ptr [rip + x]
86	.cv_loc	0 1 16 0                # t.c:16:0
87	mov	eax, dword ptr [rip + x]
88	ret
89.Ltmp4:
90.Lfunc_end0:
91                                        # -- End function
92	.comm	x,4,2                   # @x
93	.section	.debug$S,"dr"
94	.p2align	2
95	.long	4                       # Debug section magic
96	.long	241
97	.long	.Ltmp6-.Ltmp5           # Subsection size
98.Ltmp5:
99	.short	.Ltmp8-.Ltmp7           # Record length
100.Ltmp7:
101	.short	4412                    # Record kind: S_COMPILE3
102	.long	0                       # Flags and language
103	.short	208                     # CPUType
104	.short	9                       # Frontend version
105	.short	0
106	.short	0
107	.short	0
108	.short	9000                    # Backend version
109	.short	0
110	.short	0
111	.short	0
112	.asciz	"clang version 9.0.0 (git@github.com:llvm/llvm-project.git aa762a56caf3ef2b0b41c501e66d3ef32903a2d0)" # Null-terminated compiler version string
113	.p2align	2
114.Ltmp8:
115.Ltmp6:
116	.p2align	2
117	.long	246                     # Inlinee lines subsection
118	.long	.Ltmp10-.Ltmp9          # Subsection size
119.Ltmp9:
120	.long	1                       # Inlinee lines signature, extra files
121
122                                        # Inlined function inlinee_1 starts at t.c:7
123	.long	4098                    # Type index of inlined function
124	.cv_filechecksumoffset	1       # Offset into filechecksum table
125	.long	7                       # Starting line number
126	.long 2
127	.cv_filechecksumoffset	2       # Offset into filechecksum table
128	.cv_filechecksumoffset	3       # Offset into filechecksum table
129
130.Ltmp10:
131	.p2align	2
132	.section	.debug$S,"dr",associative,main
133	.p2align	2
134	.long	4                       # Debug section magic
135	.long	241                     # Symbol subsection for main
136	.long	.Ltmp12-.Ltmp11         # Subsection size
137.Ltmp11:
138	.short	.Ltmp14-.Ltmp13         # Record length
139.Ltmp13:
140	.short	4423                    # Record kind: S_GPROC32_ID
141	.long	0                       # PtrParent
142	.long	0                       # PtrEnd
143	.long	0                       # PtrNext
144	.long	.Lfunc_end0-main        # Code size
145	.long	0                       # Offset after prologue
146	.long	0                       # Offset before epilogue
147	.long	4101                    # Function type index
148	.secrel32	main            # Function section relative address
149	.secidx	main                    # Function section index
150	.byte	0                       # Flags
151	.asciz	"main"                  # Function name
152	.p2align	2
153.Ltmp14:
154	.short	.Ltmp16-.Ltmp15         # Record length
155.Ltmp15:
156	.short	4114                    # Record kind: S_FRAMEPROC
157	.long	0                       # FrameSize
158	.long	0                       # Padding
159	.long	0                       # Offset of padding
160	.long	0                       # Bytes of callee saved registers
161	.long	0                       # Exception handler offset
162	.short	0                       # Exception handler section
163	.long	0                       # Flags (defines frame register)
164	.p2align	2
165.Ltmp16:
166	.short	.Ltmp18-.Ltmp17         # Record length
167.Ltmp17:
168	.short	4429                    # Record kind: S_INLINESITE
169	.long	0                       # PtrParent
170	.long	0                       # PtrEnd
171	.long	4098                    # Inlinee type index
172	.cv_inline_linetable	1 1 7 .Lfunc_begin0 .Lfunc_end0
173	.p2align	2
174.Ltmp18:
175	.short	2                       # Record length
176	.short	4430                    # Record kind: S_INLINESITE_END
177	.short	2                       # Record length
178	.short	4431                    # Record kind: S_PROC_ID_END
179.Ltmp12:
180	.p2align	2
181	.cv_linetable	0, main, .Lfunc_end0
182	.section	.debug$S,"dr"
183	.long	241                     # Symbol subsection for globals
184	.long	.Ltmp22-.Ltmp21         # Subsection size
185.Ltmp21:
186	.short	.Ltmp24-.Ltmp23         # Record length
187.Ltmp23:
188	.short	4365                    # Record kind: S_GDATA32
189	.long	4102                    # Type
190	.secrel32	x               # DataOffset
191	.secidx	x                       # Segment
192	.asciz	"x"                     # Name
193	.p2align	2
194.Ltmp24:
195.Ltmp22:
196	.p2align	2
197	.cv_filechecksums               # File index to string table offset subsection
198	.cv_stringtable                 # String table
199	.long	241
200	.long	.Ltmp26-.Ltmp25         # Subsection size
201.Ltmp25:
202	.short	.Ltmp28-.Ltmp27         # Record length
203.Ltmp27:
204	.short	4428                    # Record kind: S_BUILDINFO
205	.long	4105                    # LF_BUILDINFO index
206	.p2align	2
207.Ltmp28:
208.Ltmp26:
209	.p2align	2
210	.section	.debug$T,"dr"
211	.p2align	2
212	.long	4                       # Debug section magic
213	# ArgList (0x1000) {
214	#   TypeLeafKind: LF_ARGLIST (0x1201)
215	#   NumArgs: 0
216	#   Arguments [
217	#   ]
218	# }
219	.byte	0x06, 0x00, 0x01, 0x12
220	.byte	0x00, 0x00, 0x00, 0x00
221	# Procedure (0x1001) {
222	#   TypeLeafKind: LF_PROCEDURE (0x1008)
223	#   ReturnType: void (0x3)
224	#   CallingConvention: NearC (0x0)
225	#   FunctionOptions [ (0x0)
226	#   ]
227	#   NumParameters: 0
228	#   ArgListType: () (0x1000)
229	# }
230	.byte	0x0e, 0x00, 0x08, 0x10
231	.byte	0x03, 0x00, 0x00, 0x00
232	.byte	0x00, 0x00, 0x00, 0x00
233	.byte	0x00, 0x10, 0x00, 0x00
234	# FuncId (0x1002) {
235	#   TypeLeafKind: LF_FUNC_ID (0x1601)
236	#   ParentScope: 0x0
237	#   FunctionType: void () (0x1001)
238	#   Name: inlinee_1
239	# }
240	.byte	0x16, 0x00, 0x01, 0x16
241	.byte	0x00, 0x00, 0x00, 0x00
242	.byte	0x01, 0x10, 0x00, 0x00
243	.byte	0x69, 0x6e, 0x6c, 0x69
244	.byte	0x6e, 0x65, 0x65, 0x5f
245	.byte	0x31, 0x00, 0xf2, 0xf1
246	# FuncId (0x1003) {
247	#   TypeLeafKind: LF_FUNC_ID (0x1601)
248	#   ParentScope: 0x0
249	#   FunctionType: void () (0x1001)
250	#   Name: inlinee_2
251	# }
252	.byte	0x16, 0x00, 0x01, 0x16
253	.byte	0x00, 0x00, 0x00, 0x00
254	.byte	0x01, 0x10, 0x00, 0x00
255	.byte	0x69, 0x6e, 0x6c, 0x69
256	.byte	0x6e, 0x65, 0x65, 0x5f
257	.byte	0x32, 0x00, 0xf2, 0xf1
258	# Procedure (0x1004) {
259	#   TypeLeafKind: LF_PROCEDURE (0x1008)
260	#   ReturnType: int (0x74)
261	#   CallingConvention: NearC (0x0)
262	#   FunctionOptions [ (0x0)
263	#   ]
264	#   NumParameters: 0
265	#   ArgListType: () (0x1000)
266	# }
267	.byte	0x0e, 0x00, 0x08, 0x10
268	.byte	0x74, 0x00, 0x00, 0x00
269	.byte	0x00, 0x00, 0x00, 0x00
270	.byte	0x00, 0x10, 0x00, 0x00
271	# FuncId (0x1005) {
272	#   TypeLeafKind: LF_FUNC_ID (0x1601)
273	#   ParentScope: 0x0
274	#   FunctionType: int () (0x1004)
275	#   Name: main
276	# }
277	.byte	0x12, 0x00, 0x01, 0x16
278	.byte	0x00, 0x00, 0x00, 0x00
279	.byte	0x04, 0x10, 0x00, 0x00
280	.byte	0x6d, 0x61, 0x69, 0x6e
281	.byte	0x00, 0xf3, 0xf2, 0xf1
282	# Modifier (0x1006) {
283	#   TypeLeafKind: LF_MODIFIER (0x1001)
284	#   ModifiedType: int (0x74)
285	#   Modifiers [ (0x2)
286	#     Volatile (0x2)
287	#   ]
288	# }
289	.byte	0x0a, 0x00, 0x01, 0x10
290	.byte	0x74, 0x00, 0x00, 0x00
291	.byte	0x02, 0x00, 0xf2, 0xf1
292	# StringId (0x1007) {
293	#   TypeLeafKind: LF_STRING_ID (0x1605)
294	#   Id: 0x0
295	#   StringData: C:\src\llvm-project\build
296	# }
297	.byte	0x22, 0x00, 0x05, 0x16
298	.byte	0x00, 0x00, 0x00, 0x00
299	.byte	0x43, 0x3a, 0x5c, 0x73
300	.byte	0x72, 0x63, 0x5c, 0x6c
301	.byte	0x6c, 0x76, 0x6d, 0x2d
302	.byte	0x70, 0x72, 0x6f, 0x6a
303	.byte	0x65, 0x63, 0x74, 0x5c
304	.byte	0x62, 0x75, 0x69, 0x6c
305	.byte	0x64, 0x00, 0xf2, 0xf1
306	# StringId (0x1008) {
307	#   TypeLeafKind: LF_STRING_ID (0x1605)
308	#   Id: 0x0
309	#   StringData: t.c
310	# }
311	.byte	0x0a, 0x00, 0x05, 0x16
312	.byte	0x00, 0x00, 0x00, 0x00
313	.byte	0x74, 0x2e, 0x63, 0x00
314	# BuildInfo (0x1009) {
315	#   TypeLeafKind: LF_BUILDINFO (0x1603)
316	#   NumArgs: 5
317	#   Arguments [
318	#     ArgType: C:\src\llvm-project\build (0x1007)
319	#     ArgType: 0x0
320	#     ArgType: t.c (0x1008)
321	#     ArgType: 0x0
322	#     ArgType: 0x0
323	#   ]
324	# }
325	.byte	0x1a, 0x00, 0x03, 0x16
326	.byte	0x05, 0x00, 0x07, 0x10
327	.byte	0x00, 0x00, 0x00, 0x00
328	.byte	0x00, 0x00, 0x08, 0x10
329	.byte	0x00, 0x00, 0x00, 0x00
330	.byte	0x00, 0x00, 0x00, 0x00
331	.byte	0x00, 0x00, 0xf2, 0xf1
332
333	.addrsig
334	.addrsig_sym x
335