479 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-windows-msvc < %s > %t.obj3# RUN: lld-link /DEBUG:FULL /nodefaultlib /entry:main %t.obj /PDB:%t.pdb /OUT:%t.exe4# RUN: llvm-pdbutil dump -types -globals -symbols -modi=0 %t.pdb | FileCheck %s5# RUN: lld-link /DEBUG:FULL /debug:ghash /nodefaultlib /entry:main %t.obj /PDB:%t.pdb /OUT:%t.exe6# RUN: llvm-pdbutil dump -types -globals -symbols -modi=0 %t.pdb | FileCheck %s7 8# CHECK: Types (TPI Stream)9# CHECK-NEXT: ============================================================10# CHECK: 0x1003 | LF_STRUCTURE [size = 44] `Struct`11# CHECK-NEXT: unique name: `.?AUStruct@@`12# CHECK-NEXT: vtable: <no type>, base list: <no type>, field list: <no type>13# CHECK-NEXT: options: forward ref (-> 0x1006) | has unique name, sizeof 014# CHECK-NEXT: 0x1004 | LF_POINTER [size = 12]15# CHECK-NEXT: referent = 0x1003, mode = pointer, opts = None, kind = ptr6416# CHECK: 0x1006 | LF_STRUCTURE [size = 44] `Struct`17# CHECK-NEXT: unique name: `.?AUStruct@@`18# CHECK-NEXT: vtable: <no type>, base list: <no type>, field list: 0x100519# CHECK-NEXT: options: has unique name, sizeof 420# CHECK: Global Symbols21# CHECK-NEXT: ============================================================22# CHECK: {{.*}} | S_UDT [size = 24] `StructTypedef`23# CHECK: original type = 0x100324# CHECK: {{.*}} | S_UDT [size = 16] `Struct`25# CHECK: original type = 0x100626# CHECK: {{.*}} | S_UDT [size = 20] `IntTypedef`27# CHECK: original type = 0x0074 (int)28# CHECK: Symbols29# CHECK-NEXT: ============================================================30# CHECK: {{.*}} | S_GPROC32 [size = 44] `main`31# CHECK-NEXT: parent = 0, end = 252, addr = 0001:0000, code size = 5232# CHECK-NEXT: type = `0x1002 (int (int, char**))`, debug start = 0, debug end = 0, flags = none33# CHECK-NOT: {{.*}} | S_END34# CHECK: {{.*}} | S_UDT [size = 28] `main::LocalTypedef`35# CHECK-NEXT: original type = 0x100436# CHECK: {{.*}} | S_END [size = 4]37 38# source code to re-generate:39# clang-cl /Z7 /GS- /GR- /c foo.cpp40#41# struct Struct {42# int x;43# };44#45# using IntTypedef = int;46# using StructTypedef = Struct;47# Struct S;48# StructTypedef SS;49# IntTypedef I;50#51# int main(int argc, char **argv) {52# using LocalTypedef = Struct*;53# LocalTypedef SPtr;54# return I + S.x + SS.x + SPtr->x;55# }56 57 .text58 .def @feat.00;59 .scl 3;60 .type 0;61 .endef62 .globl @feat.0063.set @feat.00, 064 .intel_syntax noprefix65 .def main;66 .scl 2;67 .type 32;68 .endef69 .globl main # -- Begin function main70 .p2align 4, 0x9071main: # @main72.Lfunc_begin0:73 .cv_func_id 074 .cv_file 1 "D:\\src\\llvmbuild\\cl\\Debug\\x64\\foo.cpp" "2B62298EE3EEF94E1D81FDFE18BD46A6" 175 .cv_loc 0 1 12 0 # foo.cpp:12:076.seh_proc main77# %bb.0: # %entry78 sub rsp, 3279 .seh_stackalloc 3280 .seh_endprologue81 mov dword ptr [rsp + 28], 082 mov qword ptr [rsp + 16], rdx83 mov dword ptr [rsp + 12], ecx84.Ltmp0:85 .cv_loc 0 1 15 0 # foo.cpp:15:086 mov ecx, dword ptr [rip + "?I@@3HA"]87 add ecx, dword ptr [rip + "?S@@3UStruct@@A"]88 add ecx, dword ptr [rip + "?SS@@3UStruct@@A"]89 mov rdx, qword ptr [rsp]90 add ecx, dword ptr [rdx]91 mov eax, ecx92 add rsp, 3293 ret94.Ltmp1:95.Lfunc_end0:96 .seh_handlerdata97 .text98 .seh_endproc99 # -- End function100 .bss101 .globl "?S@@3UStruct@@A" # @"?S@@3UStruct@@A"102 .p2align 2103"?S@@3UStruct@@A":104 .zero 4105 106 .globl "?SS@@3UStruct@@A" # @"?SS@@3UStruct@@A"107 .p2align 2108"?SS@@3UStruct@@A":109 .zero 4110 111 .globl "?I@@3HA" # @"?I@@3HA"112 .p2align 2113"?I@@3HA":114 .long 0 # 0x0115 116 .section .drectve,"yn"117 .ascii " /DEFAULTLIB:libcmt.lib"118 .ascii " /DEFAULTLIB:oldnames.lib"119 .section .debug$S,"dr"120 .p2align 2121 .long 4 # Debug section magic122 .long 241123 .long .Ltmp3-.Ltmp2 # Subsection size124.Ltmp2:125 .short .Ltmp5-.Ltmp4 # Record length126.Ltmp4:127 .short 4412 # Record kind: S_COMPILE3128 .long 1 # Flags and language129 .short 208 # CPUType130 .short 8 # Frontend version131 .short 0132 .short 0133 .short 0134 .short 8000 # Backend version135 .short 0136 .short 0137 .short 0138 .asciz "clang version 8.0.0 " # Null-terminated compiler version string139.Ltmp5:140.Ltmp3:141 .p2align 2142 .long 241 # Symbol subsection for main143 .long .Ltmp7-.Ltmp6 # Subsection size144.Ltmp6:145 .short .Ltmp9-.Ltmp8 # Record length146.Ltmp8:147 .short 4423 # Record kind: S_GPROC32_ID148 .long 0 # PtrParent149 .long 0 # PtrEnd150 .long 0 # PtrNext151 .long .Lfunc_end0-main # Code size152 .long 0 # Offset after prologue153 .long 0 # Offset before epilogue154 .long 4099 # Function type index155 .secrel32 main # Function section relative address156 .secidx main # Function section index157 .byte 0 # Flags158 .asciz "main" # Function name159.Ltmp9:160 .short .Ltmp11-.Ltmp10 # Record length161.Ltmp10:162 .short 4114 # Record kind: S_FRAMEPROC163 .long 32 # FrameSize164 .long 0 # Padding165 .long 0 # Offset of padding166 .long 0 # Bytes of callee saved registers167 .long 0 # Exception handler offset168 .short 0 # Exception handler section169 .long 81920 # Flags (defines frame register)170.Ltmp11:171 .short .Ltmp13-.Ltmp12 # Record length172.Ltmp12:173 .short 4414 # Record kind: S_LOCAL174 .long 116 # TypeIndex175 .short 1 # Flags176 .asciz "argc"177.Ltmp13:178 .cv_def_range .Ltmp0 .Ltmp1, frame_ptr_rel, 12179 .short .Ltmp15-.Ltmp14 # Record length180.Ltmp14:181 .short 4414 # Record kind: S_LOCAL182 .long 4096 # TypeIndex183 .short 1 # Flags184 .asciz "argv"185.Ltmp15:186 .cv_def_range .Ltmp0 .Ltmp1, frame_ptr_rel, 16187 .short .Ltmp17-.Ltmp16 # Record length188.Ltmp16:189 .short 4414 # Record kind: S_LOCAL190 .long 4101 # TypeIndex191 .short 0 # Flags192 .asciz "SPtr"193.Ltmp17:194 .cv_def_range .Ltmp0 .Ltmp1, frame_ptr_rel, 0195 .short .Ltmp19-.Ltmp18 # Record length196.Ltmp18:197 .short 4360 # Record kind: S_UDT198 .long 4101 # Type199 .asciz "main::LocalTypedef"200.Ltmp19:201 .short 2 # Record length202 .short 4431 # Record kind: S_PROC_ID_END203.Ltmp7:204 .p2align 2205 .cv_linetable 0, main, .Lfunc_end0206 .long 241 # Symbol subsection for globals207 .long .Ltmp21-.Ltmp20 # Subsection size208.Ltmp20:209 .short .Ltmp23-.Ltmp22 # Record length210.Ltmp22:211 .short 4365 # Record kind: S_GDATA32212 .long 4103 # Type213 .secrel32 "?S@@3UStruct@@A" # DataOffset214 .secidx "?S@@3UStruct@@A" # Segment215 .asciz "S" # Name216.Ltmp23:217 .short .Ltmp25-.Ltmp24 # Record length218.Ltmp24:219 .short 4365 # Record kind: S_GDATA32220 .long 4100 # Type221 .secrel32 "?SS@@3UStruct@@A" # DataOffset222 .secidx "?SS@@3UStruct@@A" # Segment223 .asciz "SS" # Name224.Ltmp25:225 .short .Ltmp27-.Ltmp26 # Record length226.Ltmp26:227 .short 4365 # Record kind: S_GDATA32228 .long 116 # Type229 .secrel32 "?I@@3HA" # DataOffset230 .secidx "?I@@3HA" # Segment231 .asciz "I" # Name232.Ltmp27:233.Ltmp21:234 .p2align 2235 .long 241236 .long .Ltmp29-.Ltmp28 # Subsection size237.Ltmp28:238 .short .Ltmp31-.Ltmp30 # Record length239.Ltmp30:240 .short 4360 # Record kind: S_UDT241 .long 4103 # Type242 .asciz "Struct"243.Ltmp31:244 .short .Ltmp33-.Ltmp32 # Record length245.Ltmp32:246 .short 4360 # Record kind: S_UDT247 .long 4100 # Type248 .asciz "StructTypedef"249.Ltmp33:250 .short .Ltmp35-.Ltmp34 # Record length251.Ltmp34:252 .short 4360 # Record kind: S_UDT253 .long 116 # Type254 .asciz "IntTypedef"255.Ltmp35:256.Ltmp29:257 .p2align 2258 .cv_filechecksums # File index to string table offset subsection259 .cv_stringtable # String table260 .long 241261 .long .Ltmp37-.Ltmp36 # Subsection size262.Ltmp36:263 .short 6 # Record length264 .short 4428 # Record kind: S_BUILDINFO265 .long 4108 # LF_BUILDINFO index266.Ltmp37:267 .p2align 2268 .section .debug$T,"dr"269 .p2align 2270 .long 4 # Debug section magic271 # Pointer (0x1000) {272 # TypeLeafKind: LF_POINTER (0x1002)273 # PointeeType: char* (0x670)274 # PtrType: Near64 (0xC)275 # PtrMode: Pointer (0x0)276 # IsFlat: 0277 # IsConst: 0278 # IsVolatile: 0279 # IsUnaligned: 0280 # IsRestrict: 0281 # IsThisPtr&: 0282 # IsThisPtr&&: 0283 # SizeOf: 8284 # }285 .byte 0x0a, 0x00, 0x02, 0x10286 .byte 0x70, 0x06, 0x00, 0x00287 .byte 0x0c, 0x00, 0x01, 0x00288 # ArgList (0x1001) {289 # TypeLeafKind: LF_ARGLIST (0x1201)290 # NumArgs: 2291 # Arguments [292 # ArgType: int (0x74)293 # ArgType: char** (0x1000)294 # ]295 # }296 .byte 0x0e, 0x00, 0x01, 0x12297 .byte 0x02, 0x00, 0x00, 0x00298 .byte 0x74, 0x00, 0x00, 0x00299 .byte 0x00, 0x10, 0x00, 0x00300 # Procedure (0x1002) {301 # TypeLeafKind: LF_PROCEDURE (0x1008)302 # ReturnType: int (0x74)303 # CallingConvention: NearC (0x0)304 # FunctionOptions [ (0x0)305 # ]306 # NumParameters: 2307 # ArgListType: (int, char**) (0x1001)308 # }309 .byte 0x0e, 0x00, 0x08, 0x10310 .byte 0x74, 0x00, 0x00, 0x00311 .byte 0x00, 0x00, 0x02, 0x00312 .byte 0x01, 0x10, 0x00, 0x00313 # FuncId (0x1003) {314 # TypeLeafKind: LF_FUNC_ID (0x1601)315 # ParentScope: 0x0316 # FunctionType: int (int, char**) (0x1002)317 # Name: main318 # }319 .byte 0x12, 0x00, 0x01, 0x16320 .byte 0x00, 0x00, 0x00, 0x00321 .byte 0x02, 0x10, 0x00, 0x00322 .byte 0x6d, 0x61, 0x69, 0x6e323 .byte 0x00, 0xf3, 0xf2, 0xf1324 # Struct (0x1004) {325 # TypeLeafKind: LF_STRUCTURE (0x1505)326 # MemberCount: 0327 # Properties [ (0x280)328 # ForwardReference (0x80)329 # HasUniqueName (0x200)330 # ]331 # FieldList: 0x0332 # DerivedFrom: 0x0333 # VShape: 0x0334 # SizeOf: 0335 # Name: Struct336 # LinkageName: .?AUStruct@@337 # }338 .byte 0x2a, 0x00, 0x05, 0x15339 .byte 0x00, 0x00, 0x80, 0x02340 .byte 0x00, 0x00, 0x00, 0x00341 .byte 0x00, 0x00, 0x00, 0x00342 .byte 0x00, 0x00, 0x00, 0x00343 .byte 0x00, 0x00, 0x53, 0x74344 .byte 0x72, 0x75, 0x63, 0x74345 .byte 0x00, 0x2e, 0x3f, 0x41346 .byte 0x55, 0x53, 0x74, 0x72347 .byte 0x75, 0x63, 0x74, 0x40348 .byte 0x40, 0x00, 0xf2, 0xf1349 # Pointer (0x1005) {350 # TypeLeafKind: LF_POINTER (0x1002)351 # PointeeType: Struct (0x1004)352 # PtrType: Near64 (0xC)353 # PtrMode: Pointer (0x0)354 # IsFlat: 0355 # IsConst: 0356 # IsVolatile: 0357 # IsUnaligned: 0358 # IsRestrict: 0359 # IsThisPtr&: 0360 # IsThisPtr&&: 0361 # SizeOf: 8362 # }363 .byte 0x0a, 0x00, 0x02, 0x10364 .byte 0x04, 0x10, 0x00, 0x00365 .byte 0x0c, 0x00, 0x01, 0x00366 # FieldList (0x1006) {367 # TypeLeafKind: LF_FIELDLIST (0x1203)368 # DataMember {369 # TypeLeafKind: LF_MEMBER (0x150D)370 # AccessSpecifier: Public (0x3)371 # Type: int (0x74)372 # FieldOffset: 0x0373 # Name: x374 # }375 # }376 .byte 0x0e, 0x00, 0x03, 0x12377 .byte 0x0d, 0x15, 0x03, 0x00378 .byte 0x74, 0x00, 0x00, 0x00379 .byte 0x00, 0x00, 0x78, 0x00380 # Struct (0x1007) {381 # TypeLeafKind: LF_STRUCTURE (0x1505)382 # MemberCount: 1383 # Properties [ (0x200)384 # HasUniqueName (0x200)385 # ]386 # FieldList: <field list> (0x1006)387 # DerivedFrom: 0x0388 # VShape: 0x0389 # SizeOf: 4390 # Name: Struct391 # LinkageName: .?AUStruct@@392 # }393 .byte 0x2a, 0x00, 0x05, 0x15394 .byte 0x01, 0x00, 0x00, 0x02395 .byte 0x06, 0x10, 0x00, 0x00396 .byte 0x00, 0x00, 0x00, 0x00397 .byte 0x00, 0x00, 0x00, 0x00398 .byte 0x04, 0x00, 0x53, 0x74399 .byte 0x72, 0x75, 0x63, 0x74400 .byte 0x00, 0x2e, 0x3f, 0x41401 .byte 0x55, 0x53, 0x74, 0x72402 .byte 0x75, 0x63, 0x74, 0x40403 .byte 0x40, 0x00, 0xf2, 0xf1404 # StringId (0x1008) {405 # TypeLeafKind: LF_STRING_ID (0x1605)406 # Id: 0x0407 # StringData: D:\src\llvmbuild\cl\Debug\x64\foo.cpp408 # }409 .byte 0x2e, 0x00, 0x05, 0x16410 .byte 0x00, 0x00, 0x00, 0x00411 .byte 0x44, 0x3a, 0x5c, 0x73412 .byte 0x72, 0x63, 0x5c, 0x6c413 .byte 0x6c, 0x76, 0x6d, 0x62414 .byte 0x75, 0x69, 0x6c, 0x64415 .byte 0x5c, 0x63, 0x6c, 0x5c416 .byte 0x44, 0x65, 0x62, 0x75417 .byte 0x67, 0x5c, 0x78, 0x36418 .byte 0x34, 0x5c, 0x66, 0x6f419 .byte 0x6f, 0x2e, 0x63, 0x70420 .byte 0x70, 0x00, 0xf2, 0xf1421 # UdtSourceLine (0x1009) {422 # TypeLeafKind: LF_UDT_SRC_LINE (0x1606)423 # UDT: Struct (0x1007)424 # SourceFile: D:\src\llvmbuild\cl\Debug\x64\foo.cpp (0x1008)425 # LineNumber: 1426 # }427 .byte 0x0e, 0x00, 0x06, 0x16428 .byte 0x07, 0x10, 0x00, 0x00429 .byte 0x08, 0x10, 0x00, 0x00430 .byte 0x01, 0x00, 0x00, 0x00431 # StringId (0x100A) {432 # TypeLeafKind: LF_STRING_ID (0x1605)433 # Id: 0x0434 # StringData: D:\\src\\llvmbuild\\cl\\Debug\\x64435 # }436 .byte 0x2a, 0x00, 0x05, 0x16437 .byte 0x00, 0x00, 0x00, 0x00438 .byte 0x44, 0x3a, 0x5c, 0x5c439 .byte 0x73, 0x72, 0x63, 0x5c440 .byte 0x5c, 0x6c, 0x6c, 0x76441 .byte 0x6d, 0x62, 0x75, 0x69442 .byte 0x6c, 0x64, 0x5c, 0x5c443 .byte 0x63, 0x6c, 0x5c, 0x5c444 .byte 0x44, 0x65, 0x62, 0x75445 .byte 0x67, 0x5c, 0x5c, 0x78446 .byte 0x36, 0x34, 0x00, 0xf1447 # StringId (0x100B) {448 # TypeLeafKind: LF_STRING_ID (0x1605)449 # Id: 0x0450 # StringData: foo.cpp451 # }452 .byte 0x0e, 0x00, 0x05, 0x16453 .byte 0x00, 0x00, 0x00, 0x00454 .byte 0x66, 0x6f, 0x6f, 0x2e455 .byte 0x63, 0x70, 0x70, 0x00456 # BuildInfo (0x100C) {457 # TypeLeafKind: LF_BUILDINFO (0x1603)458 # NumArgs: 5459 # Arguments [460 # ArgType: D:\\src\\llvmbuild\\cl\\Debug\\x64 (0x100A)461 # ArgType: 0x0462 # ArgType: foo.cpp (0x100B)463 # ArgType: 0x0464 # ArgType: 0x0465 # ]466 # }467 .byte 0x1a, 0x00, 0x03, 0x16468 .byte 0x05, 0x00, 0x0a, 0x10469 .byte 0x00, 0x00, 0x00, 0x00470 .byte 0x00, 0x00, 0x0b, 0x10471 .byte 0x00, 0x00, 0x00, 0x00472 .byte 0x00, 0x00, 0x00, 0x00473 .byte 0x00, 0x00, 0xf2, 0xf1474 475 .addrsig476 .addrsig_sym "?S@@3UStruct@@A"477 .addrsig_sym "?SS@@3UStruct@@A"478 .addrsig_sym "?I@@3HA"479