getsentry / pdb

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

Add support for reading stream names, getting raw streams #15

Closed luser closed 6 years ago

luser commented 6 years ago

I've had most of this sitting around on a branch for a while, I just forgot to finish it off and submit it.

The name stream is contained in the PDB information stream. There are a few streams that need to be looked up by name. Confusingly, one of them is named /names. That stream contains source file names, so this will be useful for some future changes I hope to write.

The second changeset here allows access to a raw Stream by index. Combined with the first patch this allows looking up a named stream and getting its contents. I don't love this change, since the Stream + ParseBuffer API is a little awkward if you're not trying to parse out data structures. Maybe it would be nicer to add a wrapper struct that just contained an as_bytes() method to hide all that?

I wanted that API to mimic read functionality of the pdbstr tool, which we use for inserting source server indexing into our PDB files.