438 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc3# RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug4# 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 %s7 8# Compiled from this cpp code, with modifications to add extra inline line and9# file changes:10# clang -cc1 -triple x86_64-windows-msvc -gcodeview -S test.cpp11#12# __attribute__((always_inline)) int inlinee_2(int x) {13# return x + 1;14# }15# __attribute__((always_inline)) int inlinee_1(int x) {16# return inlinee_2(x) + 2;17# }18# int main() {19# int x = inlinee_1(33);20# int y = inlinee_2(22);21# int z = inlinee_2(11);22# return x + y + z;23# }24 25 .text26 .def @feat.00;27 .scl 3;28 .type 0;29 .endef30 .globl @feat.0031.set @feat.00, 032 .file "test.cpp"33 .def main;34 .scl 2;35 .type 32;36 .endef37 .globl main # -- Begin function main38 .p2align 4, 0x9039main: # @main40.Lfunc_begin0:41 .cv_func_id 042 .cv_file 1 "C:\\src\\test.cpp" "67680A954FC00F980188190C8D23C68E" 143 .cv_file 2 "C:\\src\\fakefile.cpp" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 144 .cv_loc 0 1 9 0 # test.cpp:9:045# %bb.0: # %entry46 subq $32, %rsp47 movl $0, 12(%rsp)48 movl $33, 16(%rsp)49.Ltmp0:50 .cv_inline_site_id 1 within 0 inlined_at 1 10 1151 .cv_loc 1 1 6 20 # test.cpp:6:2052 53# CHECK: inlinee_154# CHECK-NEXT: C:\src\test.cpp:6:055# CHECK-NEXT: main56# CHECK-NEXT: C:\src\test.cpp:10:1157 58# CHECK: inlinee_159# CHECK-NEXT: C:\src\test.cpp:6:060# CHECK-NEXT: main61# CHECK-NEXT: C:\src\test.cpp:10:1162 movl 16(%rsp), %eax63 64# Add a line change here.65 .cv_loc 1 1 7 766 67# CHECK: inlinee_168# CHECK-NEXT: C:\src\test.cpp:7:069# CHECK-NEXT: main70# CHECK-NEXT: C:\src\test.cpp:10:1171 72# CHECK: inlinee_173# CHECK-NEXT: C:\src\test.cpp:7:074# CHECK-NEXT: main75# CHECK-NEXT: C:\src\test.cpp:10:1176 movl %eax, 20(%rsp)77.Ltmp1:78 .cv_inline_site_id 2 within 1 inlined_at 1 6 1079 .cv_loc 2 1 2 10 # test.cpp:2:1080 81# CHECK: inlinee_282# CHECK-NEXT: C:\src\test.cpp:2:083# CHECK-NEXT: inlinee_184# CHECK-NEXT: C:\src\test.cpp:6:085# CHECK-NEXT: main86# CHECK-NEXT: C:\src\test.cpp:10:1187 88# CHECK: inlinee_289# CHECK-NEXT: C:\src\test.cpp:2:090# CHECK-NEXT: inlinee_191# CHECK-NEXT: C:\src\test.cpp:6:092# CHECK-NEXT: main93# CHECK-NEXT: C:\src\test.cpp:10:1194 movl 20(%rsp), %eax95 .cv_loc 2 1 2 12 # test.cpp:2:1296 addl $1, %eax97 98# Add a file change.99 .cv_loc 2 2 102 0 # fakefile.cpp:102:0100 101# CHECK: inlinee_2102# CHECK-NEXT: C:\src\fakefile.cpp:102:0103# CHECK-NEXT: inlinee_1104# CHECK-NEXT: C:\src\test.cpp:6:0105# CHECK-NEXT: main106# CHECK-NEXT: C:\src\test.cpp:10:11107 nop108 109.Ltmp2:110 .cv_loc 1 1 6 23 # test.cpp:6:23111 112# CHECK: inlinee_1113# CHECK-NEXT: C:\src\test.cpp:6:0114# CHECK-NEXT: main115# CHECK-NEXT: C:\src\test.cpp:10:11116 addl $2, %eax117.Ltmp3:118 .cv_loc 0 1 10 7 # test.cpp:10:7119 movl %eax, 8(%rsp)120 movl $22, 28(%rsp)121.Ltmp4:122# Add a .cv_loc 0 so there is a gap in the inline site.123# CHECK: main124# CHECK-NEXT: C:\src\test.cpp:0:0125 126# CHECK: inlinee_2127# CHECK-NEXT: C:\src\test.cpp:2:0128# CHECK-NEXT: main129# CHECK-NEXT: C:\src\test.cpp:11:11130 .cv_inline_site_id 3 within 0 inlined_at 1 11 11131 .cv_loc 3 1 2 10 # test.cpp:2:10132 movl 28(%rsp), %eax133 .cv_loc 0 1 0 0134 nop135 .cv_loc 3 1 2 12 # test.cpp:2:12136 addl $1, %eax137.Ltmp5:138 .cv_loc 0 1 11 7 # test.cpp:11:7139 movl %eax, 4(%rsp)140 movl $11, 24(%rsp)141.Ltmp6:142# Same test as above but modify the .cv_inline_linetable to use an annotation143# that clang doesn't emit.144# CHECK-NOT: inlinee_2145# CHECK: main146# CHECK-NEXT: C:\src\test.cpp:11:7147 148# CHECK: inlinee_2149# CHECK-NEXT: C:\src\test.cpp:1:0150# CHECK-NEXT: main151# CHECK-NEXT: C:\src\test.cpp:11:7152.cv_inline_site_id 4 within 0 inlined_at 1 0 0153 movl 24(%rsp), %eax154 nop155 addl $1, %eax156.Ltmp7:157 .cv_loc 0 1 13 3 # test.cpp:13:3158 addq $32, %rsp159 retq160.Ltmp8:161.Lfunc_end0:162 # -- End function163 .section .debug$S,"dr"164 .p2align 2165 .long 4 # Debug section magic166 .long 241167 .long .Ltmp10-.Ltmp9 # Subsection size168.Ltmp9:169 .short .Ltmp12-.Ltmp11 # Record length170.Ltmp11:171 .short 4412 # Record kind: S_COMPILE3172 .long 1 # Flags and language173 .short 208 # CPUType174 .short 12 # Frontend version175 .short 0176 .short 0177 .short 0178 .short 12000 # Backend version179 .short 0180 .short 0181 .short 0182 .asciz "clang version 12.0.0 (https://github.com/llvm/llvm-project.git 2ef947fe318d081b12add3d411bbb2af6373c66d)" # Null-terminated compiler version string183 .p2align 2184.Ltmp12:185.Ltmp10:186 .p2align 2187 .long 246 # Inlinee lines subsection188 .long .Ltmp14-.Ltmp13 # Subsection size189.Ltmp13:190 .long 0 # Inlinee lines signature191 192 # Inlined function inlinee_1 starts at test.cpp:5193 .long 4098 # Type index of inlined function194 .cv_filechecksumoffset 1 # Offset into filechecksum table195 .long 5 # Starting line number196 197 # Inlined function inlinee_2 starts at test.cpp:1198 .long 4099 # Type index of inlined function199 .cv_filechecksumoffset 1 # Offset into filechecksum table200 .long 1 # Starting line number201.Ltmp14:202 .p2align 2203 .long 241 # Symbol subsection for main204 .long .Ltmp16-.Ltmp15 # Subsection size205.Ltmp15:206 .short .Ltmp18-.Ltmp17 # Record length207.Ltmp17:208 .short 4423 # Record kind: S_GPROC32_ID209 .long 0 # PtrParent210 .long 0 # PtrEnd211 .long 0 # PtrNext212 .long .Lfunc_end0-main # Code size213 .long 0 # Offset after prologue214 .long 0 # Offset before epilogue215 .long 4102 # Function type index216 .secrel32 main # Function section relative address217 .secidx main # Function section index218 .byte 0 # Flags219 .asciz "main" # Function name220 .p2align 2221.Ltmp18:222 .short .Ltmp20-.Ltmp19 # Record length223.Ltmp19:224 .short 4114 # Record kind: S_FRAMEPROC225 .long 32 # FrameSize226 .long 0 # Padding227 .long 0 # Offset of padding228 .long 0 # Bytes of callee saved registers229 .long 0 # Exception handler offset230 .short 0 # Exception handler section231 .long 81920 # Flags (defines frame register)232 .p2align 2233.Ltmp20:234 .short .Ltmp22-.Ltmp21 # Record length235.Ltmp21:236 .short 4414 # Record kind: S_LOCAL237 .long 116 # TypeIndex238 .short 0 # Flags239 .asciz "x"240 .p2align 2241.Ltmp22:242 .cv_def_range .Ltmp0 .Ltmp8, frame_ptr_rel, 8243 .short .Ltmp24-.Ltmp23 # Record length244.Ltmp23:245 .short 4414 # Record kind: S_LOCAL246 .long 116 # TypeIndex247 .short 0 # Flags248 .asciz "y"249 .p2align 2250.Ltmp24:251 .cv_def_range .Ltmp0 .Ltmp8, frame_ptr_rel, 4252 .short .Ltmp26-.Ltmp25 # Record length253.Ltmp25:254 .short 4414 # Record kind: S_LOCAL255 .long 116 # TypeIndex256 .short 0 # Flags257 .asciz "z"258 .p2align 2259.Ltmp26:260 .cv_def_range .Ltmp0 .Ltmp8, frame_ptr_rel, 0261 .short .Ltmp28-.Ltmp27 # Record length262.Ltmp27:263 .short 4429 # Record kind: S_INLINESITE264 .long 0 # PtrParent265 .long 0 # PtrEnd266 .long 4098 # Inlinee type index267 .cv_inline_linetable 1 1 5 .Lfunc_begin0 .Lfunc_end0268 .p2align 2269.Ltmp28:270 .short .Ltmp30-.Ltmp29 # Record length271.Ltmp29:272 .short 4414 # Record kind: S_LOCAL273 .long 116 # TypeIndex274 .short 1 # Flags275 .asciz "x"276 .p2align 2277.Ltmp30:278 .cv_def_range .Ltmp0 .Ltmp3, frame_ptr_rel, 16279 .short .Ltmp32-.Ltmp31 # Record length280.Ltmp31:281 .short 4429 # Record kind: S_INLINESITE282 .long 0 # PtrParent283 .long 0 # PtrEnd284 .long 4099 # Inlinee type index285 .cv_inline_linetable 2 1 1 .Lfunc_begin0 .Lfunc_end0286 .p2align 2287.Ltmp32:288 .short .Ltmp34-.Ltmp33 # Record length289.Ltmp33:290 .short 4414 # Record kind: S_LOCAL291 .long 116 # TypeIndex292 .short 1 # Flags293 .asciz "x"294 .p2align 2295.Ltmp34:296 .cv_def_range .Ltmp1 .Ltmp2, frame_ptr_rel, 20297 .short 2 # Record length298 .short 4430 # Record kind: S_INLINESITE_END299 .short 2 # Record length300 .short 4430 # Record kind: S_INLINESITE_END301 .short .Ltmp36-.Ltmp35 # Record length302.Ltmp35:303 .short 4429 # Record kind: S_INLINESITE304 .long 0 # PtrParent305 .long 0 # PtrEnd306 .long 4099 # Inlinee type index307 .cv_inline_linetable 3 1 1 .Lfunc_begin0 .Lfunc_end0308 .p2align 2309.Ltmp36:310 .short .Ltmp38-.Ltmp37 # Record length311.Ltmp37:312 .short 4414 # Record kind: S_LOCAL313 .long 116 # TypeIndex314 .short 1 # Flags315 .asciz "x"316 .p2align 2317.Ltmp38:318 .cv_def_range .Ltmp4 .Ltmp5, frame_ptr_rel, 28319 .short 2 # Record length320 .short 4430 # Record kind: S_INLINESITE_END321 .short .Ltmp40-.Ltmp39 # Record length322.Ltmp39:323 .short 4429 # Record kind: S_INLINESITE324 .long 0 # PtrParent325 .long 0 # PtrEnd326 .long 4099 # Inlinee type index327# Changed inline line table annotations.328 .byte 0x0C, 0x4, 0x47329 .byte 0x0C, 0x3, 0x5330 .p2align 2331.Ltmp40:332 .short .Ltmp42-.Ltmp41 # Record length333.Ltmp41:334 .short 4414 # Record kind: S_LOCAL335 .long 116 # TypeIndex336 .short 1 # Flags337 .asciz "x"338 .p2align 2339.Ltmp42:340 .cv_def_range .Ltmp6 .Ltmp7, frame_ptr_rel, 24341 .short 2 # Record length342 .short 4430 # Record kind: S_INLINESITE_END343 .short 2 # Record length344 .short 4431 # Record kind: S_PROC_ID_END345.Ltmp16:346 .p2align 2347 .cv_linetable 0, main, .Lfunc_end0348 .cv_filechecksums # File index to string table offset subsection349 .cv_stringtable # String table350 .long 241351 .long .Ltmp44-.Ltmp43 # Subsection size352.Ltmp43:353 .short .Ltmp46-.Ltmp45 # Record length354.Ltmp45:355 .short 4428 # Record kind: S_BUILDINFO356 .long 4105 # LF_BUILDINFO index357 .p2align 2358.Ltmp46:359.Ltmp44:360 .p2align 2361 .section .debug$T,"dr"362 .p2align 2363 .long 4 # Debug section magic364 # ArgList (0x1000)365 .short 0xa # Record length366 .short 0x1201 # Record kind: LF_ARGLIST367 .long 0x1 # NumArgs368 .long 0x74 # Argument: int369 # Procedure (0x1001)370 .short 0xe # Record length371 .short 0x1008 # Record kind: LF_PROCEDURE372 .long 0x74 # ReturnType: int373 .byte 0x0 # CallingConvention: NearC374 .byte 0x0 # FunctionOptions375 .short 0x1 # NumParameters376 .long 0x1000 # ArgListType: (int)377 # FuncId (0x1002)378 .short 0x16 # Record length379 .short 0x1601 # Record kind: LF_FUNC_ID380 .long 0x0 # ParentScope381 .long 0x1001 # FunctionType: int (int)382 .asciz "inlinee_1" # Name383 .byte 242384 .byte 241385 # FuncId (0x1003)386 .short 0x16 # Record length387 .short 0x1601 # Record kind: LF_FUNC_ID388 .long 0x0 # ParentScope389 .long 0x1001 # FunctionType: int (int)390 .asciz "inlinee_2" # Name391 .byte 242392 .byte 241393 # ArgList (0x1004)394 .short 0x6 # Record length395 .short 0x1201 # Record kind: LF_ARGLIST396 .long 0x0 # NumArgs397 # Procedure (0x1005)398 .short 0xe # Record length399 .short 0x1008 # Record kind: LF_PROCEDURE400 .long 0x74 # ReturnType: int401 .byte 0x0 # CallingConvention: NearC402 .byte 0x0 # FunctionOptions403 .short 0x0 # NumParameters404 .long 0x1004 # ArgListType: ()405 # FuncId (0x1006)406 .short 0x12 # Record length407 .short 0x1601 # Record kind: LF_FUNC_ID408 .long 0x0 # ParentScope409 .long 0x1005 # FunctionType: int ()410 .asciz "main" # Name411 .byte 243412 .byte 242413 .byte 241414 # StringId (0x1007)415 .short 0x2a # Record length416 .short 0x1605 # Record kind: LF_STRING_ID417 .long 0x0 # Id418 .asciz "C:\\src\\tests\\symbolizer\\asm-test" # StringData419 .byte 243420 .byte 242421 .byte 241422 # StringId (0x1008)423 .short 0xe # Record length424 .short 0x1605 # Record kind: LF_STRING_ID425 .long 0x0 # Id426 .asciz "<stdin>" # StringData427 # BuildInfo (0x1009)428 .short 0x1a # Record length429 .short 0x1603 # Record kind: LF_BUILDINFO430 .short 0x5 # NumArgs431 .long 0x1007 # Argument: C:\src432 .long 0x0 # Argument433 .long 0x1008 # Argument: <stdin>434 .long 0x0 # Argument435 .long 0x0 # Argument436 .byte 242437 .byte 241438