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-symbolizer --obj=%t.exe --relative-address \
5 # RUN: 0x1014 0x1015 0x1018 0x1019 0x101c 0x101d 0x1023 0x1024 \
6 # RUN: 0x1037 0x103A 0x104B 0x104E | FileCheck %s
8 # Compiled from this cpp code, with modifications to add extra inline line and
10 # clang -cc1 -triple x86_64-windows-msvc -gcodeview -S test.cpp
12 # __attribute__((always_inline)) int inlinee_2(int x) {
15 # __attribute__((always_inline)) int inlinee_1(int x) {
16 # return inlinee_2(x) + 2;
19 # int x = inlinee_1(33);
20 # int y = inlinee_2(22);
21 # int z = inlinee_2(11);
37 .globl main # -- Begin function main
42 .cv_file 1 "C:\\src\\test.cpp" "67680A954FC00F980188190C8D23C68E" 1
43 .cv_file 2 "C:\\src\\fakefile.cpp" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 1
44 .cv_loc 0 1 9 0 # test.cpp:9:0
50 .cv_inline_site_id 1 within 0 inlined_at 1 10 11
51 .cv_loc 1 1 6 20 # test.cpp:6:20
54 # CHECK-NEXT: C:\src\test.cpp:6:0
56 # CHECK-NEXT: C:\src\test.cpp:10:11
59 # CHECK-NEXT: C:\src\test.cpp:6:0
61 # CHECK-NEXT: C:\src\test.cpp:10:11
64 # Add a line change here.
68 # CHECK-NEXT: C:\src\test.cpp:7:0
70 # CHECK-NEXT: C:\src\test.cpp:10:11
73 # CHECK-NEXT: C:\src\test.cpp:7:0
75 # CHECK-NEXT: C:\src\test.cpp:10:11
78 .cv_inline_site_id 2 within 1 inlined_at 1 6 10
79 .cv_loc 2 1 2 10 # test.cpp:2:10
82 # CHECK-NEXT: C:\src\test.cpp:2:0
83 # CHECK-NEXT: inlinee_1
84 # CHECK-NEXT: C:\src\test.cpp:6:0
86 # CHECK-NEXT: C:\src\test.cpp:10:11
89 # CHECK-NEXT: C:\src\test.cpp:2:0
90 # CHECK-NEXT: inlinee_1
91 # CHECK-NEXT: C:\src\test.cpp:6:0
93 # CHECK-NEXT: C:\src\test.cpp:10:11
95 .cv_loc 2 1 2 12 # test.cpp:2:12
99 .cv_loc 2 2 102 0 # fakefile.cpp:102:0
102 # CHECK-NEXT: C:\src\fakefile.cpp:102:0
103 # CHECK-NEXT: inlinee_1
104 # CHECK-NEXT: C:\src\test.cpp:6:0
106 # CHECK-NEXT: C:\src\test.cpp:10:11
110 .cv_loc 1 1 6 23 # test.cpp:6:23
113 # CHECK-NEXT: C:\src\test.cpp:6:0
115 # CHECK-NEXT: C:\src\test.cpp:10:11
118 .cv_loc 0 1 10 7 # test.cpp:10:7
122 # Add a .cv_loc 0 so there is a gap in the inline site.
124 # CHECK-NEXT: C:\src\test.cpp:0:0
127 # CHECK-NEXT: C:\src\test.cpp:2:0
129 # CHECK-NEXT: C:\src\test.cpp:11:11
130 .cv_inline_site_id 3 within 0 inlined_at 1 11 11
131 .cv_loc 3 1 2 10 # test.cpp:2:10
135 .cv_loc 3 1 2 12 # test.cpp:2:12
138 .cv_loc 0 1 11 7 # test.cpp:11:7
142 # Same test as above but modify the .cv_inline_linetable to use an annotation
143 # that clang doesn't emit.
144 # CHECK-NOT: inlinee_2
146 # CHECK-NEXT: C:\src\test.cpp:11:7
149 # CHECK-NEXT: C:\src\test.cpp:1:0
151 # CHECK-NEXT: C:\src\test.cpp:11:7
152 .cv_inline_site_id 4 within 0 inlined_at 1 0 0
157 .cv_loc 0 1 13 3 # test.cpp:13:3
163 .section .debug$S,"dr"
165 .long 4 # Debug section magic
167 .long .Ltmp10-.Ltmp9 # Subsection size
169 .short .Ltmp12-.Ltmp11 # Record length
171 .short 4412 # Record kind: S_COMPILE3
172 .long 1 # Flags and language
174 .short 12 # Frontend version
178 .short 12000 # Backend version
182 .asciz "clang version 12.0.0 (https://github.com/llvm/llvm-project.git 2ef947fe318d081b12add3d411bbb2af6373c66d)" # Null-terminated compiler version string
187 .long 246 # Inlinee lines subsection
188 .long .Ltmp14-.Ltmp13 # Subsection size
190 .long 0 # Inlinee lines signature
192 # Inlined function inlinee_1 starts at test.cpp:5
193 .long 4098 # Type index of inlined function
194 .cv_filechecksumoffset 1 # Offset into filechecksum table
195 .long 5 # Starting line number
197 # Inlined function inlinee_2 starts at test.cpp:1
198 .long 4099 # Type index of inlined function
199 .cv_filechecksumoffset 1 # Offset into filechecksum table
200 .long 1 # Starting line number
203 .long 241 # Symbol subsection for main
204 .long .Ltmp16-.Ltmp15 # Subsection size
206 .short .Ltmp18-.Ltmp17 # Record length
208 .short 4423 # Record kind: S_GPROC32_ID
212 .long .Lfunc_end0-main # Code size
213 .long 0 # Offset after prologue
214 .long 0 # Offset before epilogue
215 .long 4102 # Function type index
216 .secrel32 main # Function section relative address
217 .secidx main # Function section index
219 .asciz "main" # Function name
222 .short .Ltmp20-.Ltmp19 # Record length
224 .short 4114 # Record kind: S_FRAMEPROC
227 .long 0 # Offset of padding
228 .long 0 # Bytes of callee saved registers
229 .long 0 # Exception handler offset
230 .short 0 # Exception handler section
231 .long 81920 # Flags (defines frame register)
234 .short .Ltmp22-.Ltmp21 # Record length
236 .short 4414 # Record kind: S_LOCAL
237 .long 116 # TypeIndex
242 .cv_def_range .Ltmp0 .Ltmp8, frame_ptr_rel, 8
243 .short .Ltmp24-.Ltmp23 # Record length
245 .short 4414 # Record kind: S_LOCAL
246 .long 116 # TypeIndex
251 .cv_def_range .Ltmp0 .Ltmp8, frame_ptr_rel, 4
252 .short .Ltmp26-.Ltmp25 # Record length
254 .short 4414 # Record kind: S_LOCAL
255 .long 116 # TypeIndex
260 .cv_def_range .Ltmp0 .Ltmp8, frame_ptr_rel, 0
261 .short .Ltmp28-.Ltmp27 # Record length
263 .short 4429 # Record kind: S_INLINESITE
266 .long 4098 # Inlinee type index
267 .cv_inline_linetable 1 1 5 .Lfunc_begin0 .Lfunc_end0
270 .short .Ltmp30-.Ltmp29 # Record length
272 .short 4414 # Record kind: S_LOCAL
273 .long 116 # TypeIndex
278 .cv_def_range .Ltmp0 .Ltmp3, frame_ptr_rel, 16
279 .short .Ltmp32-.Ltmp31 # Record length
281 .short 4429 # Record kind: S_INLINESITE
284 .long 4099 # Inlinee type index
285 .cv_inline_linetable 2 1 1 .Lfunc_begin0 .Lfunc_end0
288 .short .Ltmp34-.Ltmp33 # Record length
290 .short 4414 # Record kind: S_LOCAL
291 .long 116 # TypeIndex
296 .cv_def_range .Ltmp1 .Ltmp2, frame_ptr_rel, 20
297 .short 2 # Record length
298 .short 4430 # Record kind: S_INLINESITE_END
299 .short 2 # Record length
300 .short 4430 # Record kind: S_INLINESITE_END
301 .short .Ltmp36-.Ltmp35 # Record length
303 .short 4429 # Record kind: S_INLINESITE
306 .long 4099 # Inlinee type index
307 .cv_inline_linetable 3 1 1 .Lfunc_begin0 .Lfunc_end0
310 .short .Ltmp38-.Ltmp37 # Record length
312 .short 4414 # Record kind: S_LOCAL
313 .long 116 # TypeIndex
318 .cv_def_range .Ltmp4 .Ltmp5, frame_ptr_rel, 28
319 .short 2 # Record length
320 .short 4430 # Record kind: S_INLINESITE_END
321 .short .Ltmp40-.Ltmp39 # Record length
323 .short 4429 # Record kind: S_INLINESITE
326 .long 4099 # Inlinee type index
327 # Changed inline line table annotations.
328 .byte 0x0C, 0x4, 0x47
332 .short .Ltmp42-.Ltmp41 # Record length
334 .short 4414 # Record kind: S_LOCAL
335 .long 116 # TypeIndex
340 .cv_def_range .Ltmp6 .Ltmp7, frame_ptr_rel, 24
341 .short 2 # Record length
342 .short 4430 # Record kind: S_INLINESITE_END
343 .short 2 # Record length
344 .short 4431 # Record kind: S_PROC_ID_END
347 .cv_linetable 0, main, .Lfunc_end0
348 .cv_filechecksums # File index to string table offset subsection
349 .cv_stringtable # String table
351 .long .Ltmp44-.Ltmp43 # Subsection size
353 .short .Ltmp46-.Ltmp45 # Record length
355 .short 4428 # Record kind: S_BUILDINFO
356 .long 4105 # LF_BUILDINFO index
361 .section .debug$T,"dr"
363 .long 4 # Debug section magic
365 .short 0xa # Record length
366 .short 0x1201 # Record kind: LF_ARGLIST
368 .long 0x74 # Argument: int
370 .short 0xe # Record length
371 .short 0x1008 # Record kind: LF_PROCEDURE
372 .long 0x74 # ReturnType: int
373 .byte 0x0 # CallingConvention: NearC
374 .byte 0x0 # FunctionOptions
375 .short 0x1 # NumParameters
376 .long 0x1000 # ArgListType: (int)
378 .short 0x16 # Record length
379 .short 0x1601 # Record kind: LF_FUNC_ID
380 .long 0x0 # ParentScope
381 .long 0x1001 # FunctionType: int (int)
382 .asciz "inlinee_1" # Name
386 .short 0x16 # Record length
387 .short 0x1601 # Record kind: LF_FUNC_ID
388 .long 0x0 # ParentScope
389 .long 0x1001 # FunctionType: int (int)
390 .asciz "inlinee_2" # Name
394 .short 0x6 # Record length
395 .short 0x1201 # Record kind: LF_ARGLIST
398 .short 0xe # Record length
399 .short 0x1008 # Record kind: LF_PROCEDURE
400 .long 0x74 # ReturnType: int
401 .byte 0x0 # CallingConvention: NearC
402 .byte 0x0 # FunctionOptions
403 .short 0x0 # NumParameters
404 .long 0x1004 # ArgListType: ()
406 .short 0x12 # Record length
407 .short 0x1601 # Record kind: LF_FUNC_ID
408 .long 0x0 # ParentScope
409 .long 0x1005 # FunctionType: int ()
415 .short 0x2a # Record length
416 .short 0x1605 # Record kind: LF_STRING_ID
418 .asciz "C:\\src\\tests\\symbolizer\\asm-test" # StringData
423 .short 0xe # Record length
424 .short 0x1605 # Record kind: LF_STRING_ID
426 .asciz "<stdin>" # StringData
428 .short 0x1a # Record length
429 .short 0x1603 # Record kind: LF_BUILDINFO
431 .long 0x1007 # Argument: C:\src
433 .long 0x1008 # Argument: <stdin>