getsentry / pdb

A parser for Microsoft PDB (Program Database) debugging information
https://docs.rs/pdb/
Apache License 2.0
367 stars 68 forks source link

Take advantage of the type index offset data #139

Open jrmuizel opened 1 year ago

jrmuizel commented 1 year ago

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 commented 1 year ago

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

mstange commented 1 year ago

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

DrChat commented 1 year ago

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