Rename CODE_OWNERS -> Maintainers (#114544)
[llvm-project.git] / lld / test / COFF / pdb.test
blob5492fececccd55eea5591d88d8daace2747a735a
1 # RUN: yaml2obj %p/Inputs/pdb1.yaml -o %t1.obj
2 # RUN: yaml2obj %p/Inputs/pdb2.yaml -o %t2.obj
3 # RUN: rm -f %t.dll %t.pdb
4 # RUN: lld-link /debug /pdb:%t.pdb /pdbaltpath:test.pdb /dll /out:%t.dll \
5 # RUN:   /entry:main /nodefaultlib %t1.obj %t2.obj
7 # RUN: llvm-pdbutil pdb2yaml -stream-metadata -stream-directory -pdb-stream \
8 # RUN:   -dbi-stream -ipi-stream -tpi-stream %t.pdb | FileCheck %s
10 # RUN: llvm-pdbutil dump -modules -section-map -section-contribs -section-headers \
11 # RUN:   -publics -public-extras -types -ids -type-extras -id-extras %t.pdb \
12 # RUN:   | FileCheck -check-prefix RAW %s
14 # CHECK:      MSF:
15 # CHECK-NEXT:   SuperBlock:
16 # CHECK-NEXT:     BlockSize:       4096
17 # CHECK-NEXT:     FreeBlockMap:    2
18 # CHECK-NEXT:     NumBlocks:
19 # CHECK-NEXT:     NumDirectoryBytes:
20 # CHECK-NEXT:     Unknown1:        0
21 # CHECK-NEXT:     BlockMapAddr:
22 # CHECK-NEXT:   NumDirectoryBlocks:
23 # CHECK-NEXT:   DirectoryBlocks:
24 # CHECK-NEXT:   NumStreams:
25 # CHECK-NEXT:   FileSize:
26 # CHECK-NEXT: StreamSizes:
27 # CHECK:      StreamMap:
28 # CHECK:      PdbStream:
29 # CHECK-NEXT:   Age:             1
30 # CHECK-NEXT:   Guid:
31 # CHECK-NEXT:   Signature:
32 # CHECK-NEXT:   Features:        [ VC140 ]
33 # CHECK-NEXT:   Version:         VC70
34 # CHECK-NEXT: DbiStream:
35 # CHECK-NEXT:   VerHeader:       V70
36 # CHECK-NEXT:   Age:             1
37 # CHECK-NEXT:   BuildNumber:     36363
38 # CHECK-NEXT:   PdbDllVersion:   0
39 # CHECK-NEXT:   PdbDllRbld:      0
40 # CHECK-NEXT:   Flags:           0
41 # CHECK-NEXT:   MachineType:     Amd64
42 # CHECK-NEXT: TpiStream:
43 # CHECK-NEXT:   Version:         VC80
44 # CHECK-NEXT:   Records:
45 # CHECK-NEXT:     - Kind:            LF_ARGLIST
46 # CHECK-NEXT:       ArgList:
47 # CHECK-NEXT:         ArgIndices:      [  ]
48 # CHECK-NEXT:     - Kind:            LF_PROCEDURE
49 # CHECK-NEXT:       Procedure:
50 # CHECK-NEXT:         ReturnType:      116
51 # CHECK-NEXT:         CallConv:        NearC
52 # CHECK-NEXT:         Options:         [ None ]
53 # CHECK-NEXT:         ParameterCount:  0
54 # CHECK-NEXT:         ArgumentList:    4096
55 # CHECK-NEXT:     - Kind:            LF_POINTER
56 # CHECK-NEXT:       Pointer:
57 # CHECK-NEXT:         ReferentType:    4097
58 # CHECK-NEXT:         Attrs:           65548
59 # CHECK-NEXT:     - Kind:            LF_ARGLIST
60 # CHECK-NEXT:       ArgList:
61 # CHECK-NEXT:         ArgIndices:      [ 0 ]
62 # CHECK-NEXT:     - Kind:            LF_PROCEDURE
63 # CHECK-NEXT:       Procedure:
64 # CHECK-NEXT:         ReturnType:      116
65 # CHECK-NEXT:         CallConv:        NearC
66 # CHECK-NEXT:         Options:         [ None ]
67 # CHECK-NEXT:         ParameterCount:  0
68 # CHECK-NEXT:         ArgumentList:    4099
69 # CHECK-NEXT: IpiStream:
70 # CHECK-NEXT:   Version:         VC80
71 # CHECK-NEXT:   Records:
72 # CHECK-NEXT:     - Kind:            LF_FUNC_ID
73 # CHECK-NEXT:       FuncId:
74 # CHECK-NEXT:         ParentScope:     0
75 # CHECK-NEXT:         FunctionType:    4100
76 # CHECK-NEXT:         Name:            main
77 # CHECK-NEXT:     - Kind:            LF_FUNC_ID
78 # CHECK-NEXT:       FuncId:
79 # CHECK-NEXT:         ParentScope:     0
80 # CHECK-NEXT:         FunctionType:    4097
81 # CHECK-NEXT:         Name:            foo
82 # CHECK-NEXT:     - Kind:            LF_STRING_ID
83 # CHECK-NEXT:       StringId:
84 # CHECK-NEXT:         Id:              0
85 # CHECK-NEXT:         String:          'D:\b'
86 # CHECK-NEXT:     - Kind:            LF_STRING_ID
87 # CHECK-NEXT:       StringId:
88 # CHECK-NEXT:         Id:              0
89 # CHECK-NEXT:         String:          'C:\vs14\VC\BIN\amd64\cl.exe'
90 # CHECK-NEXT:     - Kind:            LF_STRING_ID
91 # CHECK-NEXT:       StringId:
92 # CHECK-NEXT:         Id:              0
93 # CHECK-NEXT:         String:          '-Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared"'
94 # CHECK-NEXT:     - Kind:            LF_SUBSTR_LIST
95 # CHECK-NEXT:       StringList:
96 # CHECK-NEXT:         StringIndices:   [ 4100 ]
97 # CHECK-NEXT:     - Kind:            LF_STRING_ID
98 # CHECK-NEXT:       StringId:
99 # CHECK-NEXT:         Id:              4101
100 # CHECK-NEXT:         String:          ' -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X'
101 # CHECK-NEXT:     - Kind:            LF_STRING_ID
102 # CHECK-NEXT:       StringId:
103 # CHECK-NEXT:         Id:              0
104 # CHECK-NEXT:         String:          ret42-main.c
105 # CHECK-NEXT:     - Kind:            LF_STRING_ID
106 # CHECK-NEXT:       StringId:
107 # CHECK-NEXT:         Id:              0
108 # CHECK-NEXT:         String:          'D:\b\vc140.pdb'
109 # CHECK-NEXT:     - Kind:            LF_BUILDINFO
110 # CHECK-NEXT:       BuildInfo:
111 # CHECK-NEXT:         ArgIndices:      [ 4098, 4099, 4103, 4104, 4102 ]
112 # CHECK-NEXT:     - Kind:            LF_STRING_ID
113 # CHECK-NEXT:       StringId:
114 # CHECK-NEXT:         Id:              0
115 # CHECK-NEXT:         String:          ret42-sub.c
116 # CHECK-NEXT:     - Kind:            LF_BUILDINFO
117 # CHECK-NEXT:       BuildInfo:
118 # CHECK-NEXT:         ArgIndices:      [ 4098, 4099, 4106, 4104, 4102 ]
120 RAW:                               Modules
121 RAW-NEXT: ============================================================
122 RAW-NEXT:   Mod 0000 | `{{.*}}pdb.test.tmp1.obj`:
123 RAW-NEXT:              SC[.text]  | mod = 0, 0001:0000, size = 14, data crc = 1682752513, reloc crc = 0
124 RAW-NEXT:                           IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_16BYTES | IMAGE_SCN_MEM_EXECUTE |
125 RAW-NEXT:                           IMAGE_SCN_MEM_READ
126 RAW-NEXT:              Obj: `{{.*}}pdb.test.tmp1.obj`:
127 RAW-NEXT:              debug stream: 11, # files: 1, has ec info: false
128 RAW-NEXT:              pdb file ni: 0 ``, src file ni: 0 ``
129 RAW-NEXT:   Mod 0001 | `{{.*}}pdb.test.tmp2.obj`:
130 RAW-NEXT:              SC[.text]  | mod = 1, 0001:0016, size = 6, data crc = 2139436471, reloc crc = 0
131 RAW-NEXT:                           IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_16BYTES | IMAGE_SCN_MEM_EXECUTE |
132 RAW-NEXT:                           IMAGE_SCN_MEM_READ
133 RAW-NEXT:              Obj: `{{.*}}pdb.test.tmp2.obj`:
134 RAW-NEXT:              debug stream: 12, # files: 1, has ec info: false
135 RAW-NEXT:              pdb file ni: 0 ``, src file ni: 0 ``
136 RAW-NEXT:   Mod 0002 | `* Linker *`:
137 RAW-NEXT:              SC[???]  | mod = 65535, 65535:0000, size = -1, data crc = 0, reloc crc = 0
138 RAW-NEXT:                         none
139 RAW-NEXT:              Obj: ``:
140 RAW-NEXT:              debug stream: 13, # files: 0, has ec info: false
141 RAW-NEXT:              pdb file ni: 1 `{{.*pdb.test.tmp.pdb}}`, src file ni: 0 ``
142 RAW:                          Types (TPI Stream)
143 RAW-NEXT: ============================================================
144 RAW-NEXT:   Showing 5 records
145 RAW-NEXT:   0x1000 | LF_ARGLIST [size = 8, hash = 0x32484]
146 RAW-NEXT:   0x1001 | LF_PROCEDURE [size = 16, hash = 0x27EE9]
147 RAW-NEXT:            return type = 0x0074 (int), # args = 0, param list = 0x1000
148 RAW-NEXT:            calling conv = cdecl, options = None
149 RAW-NEXT:   0x1002 | LF_POINTER [size = 12, hash = 0x39732]
150 RAW-NEXT:            referent = 0x1001, mode = pointer, opts = None, kind = ptr64
151 RAW-NEXT:   0x1003 | LF_ARGLIST [size = 12, hash = 0x1FC10]
152 RAW-NEXT:            <no type>: ``
153 RAW-NEXT:   0x1004 | LF_PROCEDURE [size = 16, hash = 0x1BD3]
154 RAW-NEXT:            return type = 0x0074 (int), # args = 0, param list = 0x1003
155 RAW-NEXT:            calling conv = cdecl, options = None
156 RAW:                          Types (IPI Stream)
157 RAW-NEXT: ============================================================
158 RAW-NEXT:   Showing 12 records
159 RAW-NEXT:   0x1000 | LF_FUNC_ID [size = 20, hash = 0x38E5A]
160 RAW-NEXT:            name = main, type = 0x1004, parent scope = <no type>
161 RAW-NEXT:   0x1001 | LF_FUNC_ID [size = 16, hash = 0xD08E]
162 RAW-NEXT:            name = foo, type = 0x1001, parent scope = <no type>
163 RAW-NEXT:   0x1002 | LF_STRING_ID [size = 16, hash = 0x3EBD9] ID: <no type>, String: D:\b
164 RAW-NEXT:   0x1003 | LF_STRING_ID [size = 36, hash = 0xD327] ID: <no type>, String: C:\vs14\VC\BIN\amd64\cl.exe
165 RAW-NEXT:   0x1004 | LF_STRING_ID [size = 260, hash = 0x2FA6A]  ID: <no type>, String: -Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared"
166 RAW-NEXT:   0x1005 | LF_SUBSTR_LIST [size = 12, hash = 0x6053]
167 RAW-NEXT:            0x1004: `-Z7 -c -MT -IC:\vs14\VC\INCLUDE -IC:\vs14\VC\ATLMFC\INCLUDE -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared"`
168 RAW-NEXT:   0x1006 | LF_STRING_ID [size = 132, hash = 0xCAC7] ID: 0x1005, String:  -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X
169 RAW-NEXT:   0x1007 | LF_STRING_ID [size = 24, hash = 0x21783] ID: <no type>, String: ret42-main.c
170 RAW-NEXT:   0x1008 | LF_STRING_ID [size = 24, hash = 0x1DB87] ID: <no type>, String: D:\b\vc140.pdb
171 RAW-NEXT:   0x1009 | LF_BUILDINFO [size = 28, hash = 0x5E91]
172 RAW-NEXT:            0x1002: `D:\b`
173 RAW-NEXT:            0x1003: `C:\vs14\VC\BIN\amd64\cl.exe`
174 RAW-NEXT:            0x1007: `ret42-main.c`
175 RAW-NEXT:            0x1008: `D:\b\vc140.pdb`
176 RAW-NEXT:            0x1006: ` -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X`
177 RAW-NEXT:   0x100A | LF_STRING_ID [size = 20, hash = 0x7C68] ID: <no type>, String: ret42-sub.c
178 RAW-NEXT:   0x100B | LF_BUILDINFO [size = 28, hash = 0x254D2]
179 RAW-NEXT:            0x1002: `D:\b`
180 RAW-NEXT:            0x1003: `C:\vs14\VC\BIN\amd64\cl.exe`
181 RAW-NEXT:            0x100A: `ret42-sub.c`
182 RAW-NEXT:            0x1008: `D:\b\vc140.pdb`
183 RAW-NEXT:            0x1006: ` -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TC -X`
184 RAW:                            Public Symbols
185 RAW-NEXT: ============================================================
186 RAW-NEXT:   Publics Header
187 RAW-NEXT:     sym hash = 556, thunk table addr = 0000:0000
188 RAW-NEXT:   GSI Header
189 RAW-NEXT:     sig = 0xFFFFFFFF, hdr = 0xF12F091A, hr size = 16, num buckets = 524
190 RAW-NEXT:   Records
191 RAW-NEXT:       20 | S_PUB32 [size = 20] `main`
192 RAW-NEXT:            flags = function, addr = 0001:0000
193 RAW-NEXT:        0 | S_PUB32 [size = 20] `foo`
194 RAW-NEXT:            flags = function, addr = 0001:0016
195 RAW-NOT:             S_PUB32
196 RAW-NEXT:   Hash Entries
197 RAW-NEXT:     off = 21, refcnt = 1
198 RAW-NEXT:     off = 1, refcnt = 1
199 RAW-NEXT:   Hash Buckets
200 RAW-NEXT:     0x00000000
201 RAW-NEXT:     0x0000000c
202 RAW-NEXT:   Address Map
203 RAW-NEXT:     off = 20
204 RAW-NEXT:     off = 0
205 RAW:                            Section Headers
206 RAW-NEXT: ============================================================
208 RAW:        SECTION HEADER #1
209 RAW-NEXT:     .text name
210 RAW-NEXT:        16 virtual size
211 RAW-NEXT:      1000 virtual address
212 RAW-NEXT:       200 size of raw data
213 RAW-NEXT:       400 file pointer to raw data
214 RAW-NEXT:         0 file pointer to relocation table
215 RAW-NEXT:         0 file pointer to line numbers
216 RAW-NEXT:         0 number of relocations
217 RAW-NEXT:         0 number of line numbers
218 RAW-NEXT:  60000020 flags
219 RAW-NEXT:           IMAGE_SCN_CNT_CODE
220 RAW-NEXT:           IMAGE_SCN_MEM_EXECUTE
221 RAW-NEXT:           IMAGE_SCN_MEM_READ
222 RAW:        SECTION HEADER #2
223 RAW-NEXT:    .rdata name
224 RAW-NEXT:           virtual size
225 RAW-NEXT:      2000 virtual address
226 RAW-NEXT:       200 size of raw data
227 RAW-NEXT:       600 file pointer to raw data
228 RAW-NEXT:         0 file pointer to relocation table
229 RAW-NEXT:         0 file pointer to line numbers
230 RAW-NEXT:         0 number of relocations
231 RAW-NEXT:         0 number of line numbers
232 RAW-NEXT:  40000040 flags
233 RAW-NEXT:           IMAGE_SCN_CNT_INITIALIZED_DATA
234 RAW-NEXT:           IMAGE_SCN_MEM_READ
235 RAW:        SECTION HEADER #3
236 RAW-NEXT:    .pdata name
237 RAW-NEXT:         C virtual size
238 RAW-NEXT:      3000 virtual address
239 RAW-NEXT:       200 size of raw data
240 RAW-NEXT:       800 file pointer to raw data
241 RAW-NEXT:         0 file pointer to relocation table
242 RAW-NEXT:         0 file pointer to line numbers
243 RAW-NEXT:         0 number of relocations
244 RAW-NEXT:         0 number of line numbers
245 RAW-NEXT:  40000040 flags
246 RAW-NEXT:           IMAGE_SCN_CNT_INITIALIZED_DATA
247 RAW-NEXT:           IMAGE_SCN_MEM_READ
248 RAW:                        Original Section Headers
249 RAW-NEXT: ============================================================
250 RAW-NEXT:   PDB does not contain the requested image section header type
251 RAW:                        Section Contributions
252 RAW-NEXT: ============================================================
254 RAW-NEXT:   SC[.text]   | mod = 0, 0001:0000, size = 14, data crc = 1682752513, reloc crc = 0
255 RAW-NEXT:                 IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_16BYTES | IMAGE_SCN_MEM_EXECUTE |
256 RAW-NEXT:                 IMAGE_SCN_MEM_READ
257 RAW-NEXT:   SC[.text]   | mod = 1, 0001:0016, size = 6, data crc = 2139436471, reloc crc = 0
258 RAW-NEXT:                 IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_16BYTES | IMAGE_SCN_MEM_EXECUTE |
259 RAW-NEXT:                 IMAGE_SCN_MEM_READ
260 RAW-NEXT:   SC[.rdata]  | mod = 2, 0002:0000, size = {{[0-9]+}}, data crc = 0, reloc crc = 0
261 RAW-NEXT:                 IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
262 RAW-NEXT:   SC[.rdata]  | mod = 2, 0002:0028, size = {{[0-9]+}}, data crc = 0, reloc crc = 0
263 RAW-NEXT:                 IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
264 RAW-NEXT:   SC[.rdata]  | mod = 0, 0002:0064, size = {{[0-9]+}}, data crc = 264583633, reloc crc = 0
265 RAW-NEXT:                 IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
266 RAW-NEXT:   SC[.pdata]  | mod = 0, 0003:0000, size = 12, data crc = 361370162, reloc crc = 0
267 RAW-NEXT:                 IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
268 RAW-NOT: SC[
269 RAW:                             Section Map
270 RAW-NEXT: ============================================================
272 RAW-NEXT:   Section 0000 | ovl = 0, group = 0, frame = 1, name = 65535
273 RAW-NEXT:                  class = 65535, offset = 0, size =
274 RAW-NEXT:                  flags = read | execute | 32 bit addr | selector
275 RAW-NEXT:   Section 0001 | ovl = 0, group = 0, frame = 2, name = 65535
276 RAW-NEXT:                  class = 65535, offset = 0, size =
277 RAW-NEXT:                  flags = read | 32 bit addr | selector
278 RAW-NEXT:   Section 0002 | ovl = 0, group = 0, frame = 3, name = 65535
279 RAW-NEXT:                  class = 65535, offset = 0, size =
280 RAW-NEXT:                  flags = read | 32 bit addr | selector
281 RAW-NEXT:   Section 0003 | ovl = 0, group = 0, frame = 4, name = 65535
282 RAW-NEXT:                  class = 65535, offset = 0, size = 4294967295
283 RAW-NEXT:                  flags = 32 bit addr | absolute addr