Type merging in some PDBs results in bad pointer typedefs
| Bugzilla Link | 37492 |
| Resolution | FIXED |
| Resolved on | May 17, 2018 14:14 |
| Version | unspecified |
| OS | Windows NT |
| CC | @rnk |
Extended Description
The type records for some typedefs, like std::vector<unsigned char>::const_pointer, sometimes do not have the correct pointee type. It should be const unsigned char, but it's a bitfield. Similar problem for const_reference and std::array<unsigned char>.
Discovered in the webview.dll.pdb from a debug Chrome build.
You can observe the problem by running llvm-pdbutil pretty -types webview.dll.pdb, which will effective assert on the bad type. If you use dump -types, you can manually follow the type IDs to an LF_BITFIELD.
This does not happen for all PDBs.
Here are some excerpts to illustrate:
0x3E25 | LF_CLASS [size = 124] `std::vector<unsigned char,std::allocator<unsigned char> >`
unique name: `.?AV?$vector@EV?$allocator@E@std@@@std@@`
vtable: <no type>, base list: <no type>, field list: 0x3E24
options: contains nested class | has unique name
If we look in the field list for 0x3E24, we find:
- LF_NESTTYPE [name = `const_pointer`, parent = 0x27F1]
Following the parent:
0x27F1 | LF_POINTER [size = 12]
referent = 0x22C6, mode = pointer, opts = None, kind = ptr32
And finally, the referent leads to:
0x22C6 | LF_BITFIELD [size = 12]
type = 0x0020 (unsigned char), bit offset = 0, # bits = 1
This was a bug in type merging, but only in the compile step, not the link step, which was pretty weird. The bug was in global type hashing, which is what the compiler always uses now. The linker doesn't.
Should be fixed by r332664, it was a one line fix to include the record prefix in the hashed bytes.
I'm able to reproduce the llvm-pdbutil crash on webview.dll.pdb while printing std::vector<unsigned char,std::allocator