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 the module information stream for modules, iterating over module private symbols. #11

Closed luser closed 6 years ago

luser commented 6 years ago

This patch adds a PDB::module_info function to get the module info stream for a specific module, a new ModuleInfo struct to hold that stream's data, and a ModuleInfo::symbols function to get a SymbolIter to iterate over the module's private symbols.

It was also necessary to change SymbolIter::next to accept symbols that are exactly 2 bytes in length, since there are symbols like that in the in-tree test PDB (S_END, among others).

The pdb_symbols example was also changed to iterate over and print module private symbols, although that's less useful than one might think because Symbol::parse doesn't support the full set of symbol records that show up there.

The module information stream also contains line info, so adding support for that on top of this change should be straightforward.

I tried to add useful doc comments and examples, hopefully I followed the project conventions well enough!

willglynn commented 6 years ago

Looks great!