getsentry / pdb

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

Add a helper to get a stream by name. #21

Closed jrmuizel closed 5 years ago

jrmuizel commented 6 years ago

Not sure if 'named_stream' is the best name. Open to suggestions.

willglynn commented 6 years ago

What need does this address? I'm used to starting at well-known stream numbers and following data structures into other numbered streams; indexing streams by name makes me nervous.

jrmuizel commented 6 years ago

This is used for looking up the '/names' stream which is where the file names for the line information is stored. It corresponds to https://github.com/llvm-mirror/llvm/blob/205cff101830ef0cb2510ec3cce5e04759257acc/lib/DebugInfo/PDB/Native/PDBFile.cpp#L373

luser commented 5 years ago

I'm not entirely sure why (as with most things about the PDB format) but some streams have well-known numbers, other streams have arbitrary stream numbers located inside well-known streams, and yet other streams have well-known names whose stream numbers must be looked up in the names map contained within the PDB information stream.

willglynn commented 5 years ago

Fair enough. Thanks!