1 Replicate this scenario:
12 struct Foo { int x; };
13 int g(struct Foo *p) { return p->x; }
15 $ cl -c a.c b.c -Zi -Fdts.pdb
17 $ lld-link a.obj b.obj -debug -entry:main -nodefaultlib -out:t.exe
19 RUN: rm -rf %t && mkdir -p %t && cd %t
20 RUN: yaml2obj %S/Inputs/pdb-type-server-simple-a.yaml -o a.obj
21 RUN: yaml2obj %S/Inputs/pdb-type-server-simple-b.yaml -o b.obj
22 RUN: llvm-pdbutil yaml2pdb %S/Inputs/pdb-type-server-simple-ts.yaml -pdb ts.pdb
23 RUN: lld-link a.obj b.obj -entry:main -debug:noghash -out:t.exe -pdb:t.pdb -nodefaultlib -summary | FileCheck %s -check-prefix SUMMARY
24 RUN: llvm-pdbutil dump -symbols -types -ids -globals %t/t.pdb | FileCheck %s
26 Re-run with /DEBUG:GHASH
27 RUN: lld-link a.obj b.obj -entry:main -debug:ghash -out:t.exe -pdb:t.pdb -nodefaultlib -summary -verbose
28 RUN: llvm-pdbutil dump -symbols -types -ids -globals %t/t.pdb | FileCheck %s
31 CHECK-LABEL: Types (TPI Stream)
32 CHECK: ============================================================
34 CHECK: [[FOO_DECL:[^ ]*]] | LF_STRUCTURE [size = 36] `Foo`
36 CHECK: [[FOO_PTR:[^ ]*]] | LF_POINTER [size = 12]
37 CHECK-NEXT: referent = [[FOO_DECL]]
39 CHECK: [[G_ARGS:[^ ]*]] | LF_ARGLIST [size = 12]
40 CHECK-NEXT: [[FOO_PTR]]: `Foo*`
42 CHECK: [[G_PROTO:[^ ]*]] | LF_PROCEDURE [size = 16]
43 CHECK-NEXT: return type = 0x0074 (int), # args = 1, param list = [[G_ARGS]]
44 CHECK-NEXT: calling conv = cdecl, options = None
46 CHECK: [[FOO_COMPLETE:[^ ]*]] | LF_STRUCTURE [size = 36] `Foo`
47 CHECK-NEXT: unique name: `.?AUFoo@@`
48 CHECK-NEXT: vtable: <no type>, base list: <no type>, field list: 0x{{.*}}
49 CHECK: options: has unique name
50 CHECK: [[MAIN_PROTO:[^ ]*]] | LF_PROCEDURE [size = 16]
51 CHECK: return type = 0x0074 (int), # args = 0, param list = 0x{{.*}}
52 CHECK: calling conv = cdecl, options = None
55 CHECK-LABEL: Types (IPI Stream)
56 CHECK: ============================================================
57 CHECK: [[MAIN_ID:[^ ]*]] | LF_FUNC_ID [size = 20]
58 CHECK: name = main, type = [[MAIN_PROTO]], parent scope = <no type>
59 CHECK: [[G_ID:[^ ]*]] | LF_FUNC_ID [size = 16]
60 CHECK: name = g, type = [[G_PROTO]], parent scope = <no type>
61 CHECK: [[A_BUILD:[^ ]*]] | LF_BUILDINFO [size = 28]
63 CHECK: [[B_BUILD:[^ ]*]] | LF_BUILDINFO [size = 28]
66 CHECK-LABEL: Global Symbols
67 CHECK: ============================================================
69 CHECK-NEXT: 36 | S_PROCREF [size = 20] `main`
70 CHECK-NEXT: module = 1, sum name = 0, offset = 104
71 CHECK-NEXT: 68 | S_PROCREF [size = 16] `g`
72 CHECK-NEXT: module = 2, sum name = 0, offset = 104
73 CHECK-NEXT: 56 | S_UDT [size = 12] `Foo`
74 CHECK-NEXT: original type = 0x1006
77 CHECK: ============================================================
78 CHECK-LABEL: Mod 0000 | `{{.*}}a.obj`:
79 CHECK: 4 | S_OBJNAME [size = 40] sig=0, `C:\src\llvm-project\build\a.obj`
80 CHECK: 104 | S_GPROC32 [size = 44] `main`
81 CHECK: parent = 0, end = 196, addr = 0001:0000, code size = 27
82 CHECK: type = {{.*}}, debug start = 4, debug end = 22, flags = none
83 CHECK: 200 | S_BUILDINFO [size = 8] BuildId = `[[A_BUILD]]`
84 CHECK-LABEL: Mod 0001 | `{{.*}}b.obj`:
85 CHECK: 4 | S_OBJNAME [size = 40] sig=0, `C:\src\llvm-project\build\b.obj`
86 CHECK: 44 | S_COMPILE3 [size = 60]
87 CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, language = c
88 CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
89 CHECK: flags = security checks | hot patchable
90 CHECK: 104 | S_GPROC32 [size = 44] `g`
91 CHECK: parent = 0, end = 196, addr = 0001:0032, code size = 13
92 CHECK: type = {{.*}}, debug start = 5, debug end = 12, flags = none
93 CHECK: 148 | S_FRAMEPROC [size = 32]
94 CHECK: size = 0, padding size = 0, offset to padding = 0
95 CHECK: bytes of callee saved registers = 0, exception handler addr = 0000:0000
96 CHECK: flags = has async eh | opt speed
97 CHECK: 180 | S_REGREL32 [size = 16] `p`
98 CHECK: type = [[FOO_PTR]] (Foo*), register = RSP, offset = 8
99 CHECK: 196 | S_END [size = 4]
100 CHECK: 200 | S_BUILDINFO [size = 8] BuildId = `[[B_BUILD]]`
101 CHECK-LABEL: Mod 0002 | `* Linker *`:
104 SUMMARY-NEXT: --------------------------------------------------------------------------------
105 SUMMARY-NEXT: 2 Input OBJ files (expanded from all cmd-line inputs)
106 SUMMARY-NEXT: 1 PDB type server dependencies
107 SUMMARY-NEXT: 0 Precomp OBJ dependencies
108 SUMMARY-NEXT: 25 Input type records
109 SUMMARY-NEXT: 868 Input type records bytes
110 SUMMARY-NEXT: 9 Merged TPI records
111 SUMMARY-NEXT: 16 Merged IPI records
112 SUMMARY-NEXT: 3 Output PDB strings
113 SUMMARY-NEXT: 4 Global symbol records
114 SUMMARY-NEXT: 14 Module symbol records
115 SUMMARY-NEXT: 2 Public symbol records
117 SUMMARY: Top 10 types responsible for the most TPI input:
118 SUMMARY-NEXT: index total bytes count size
119 SUMMARY-NEXT: 0x1006: 36 = 1 * 36
120 SUMMARY: Run llvm-pdbutil to print details about a particular record:
121 SUMMARY-NEXT: llvm-pdbutil dump -types -type-index 0x1006 t.pdb
123 SUMMARY: Top 10 types responsible for the most IPI input:
124 SUMMARY-NEXT: index total bytes count size
125 SUMMARY-NEXT: 0x1006: 256 = 1 * 256
126 SUMMARY: Run llvm-pdbutil to print details about a particular record:
127 SUMMARY-NEXT: llvm-pdbutil dump -ids -id-index 0x1006 t.pdb