pdb icon indicating copy to clipboard operation
pdb copied to clipboard

Take advantage of the type index offset data

Open jrmuizel opened this issue 2 years ago • 3 comments

From LLVM:

/// Type streams in PDBs contain an additional field which is a list of pairs
/// containing indices and their corresponding offsets, roughly every ~8KB of
/// record data.  This general idea need not be confined to PDBs though.  By
/// supplying such an array, the producer of a type stream can allow the
/// consumer much better access time, because the consumer can find the nearest
/// index in this array, and do a linear scan forward only from there.

jrmuizel avatar Jul 26 '22 17:07 jrmuizel

This data is referenced in the header here: https://github.com/willglynn/pdb/blob/b052964e09d03eb190c8a60dc76344150ff8a9df/src/tpi/header.rs#L31

jrmuizel avatar Jul 26 '22 17:07 jrmuizel

ItemFinder currently builds such an index -> offset map itself (in the positions Vec). It would be great if it could use this existing table.

mstange avatar Jul 26 '22 17:07 mstange

For reference, here is the link to the LLVM code cited by OP: https://github.com/llvm/llvm-project/blob/962c306a11d0a21c884c12e18825b8a41ba1bd7d/llvm/include/llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h#L35-L40

DrChat avatar Mar 17 '23 16:03 DrChat