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

Determining source file and line information for global symbols (UDT, modules) #109

Open camden-smallwood opened 2 years ago

camden-smallwood commented 2 years ago

I'm currently working on a naive pdb-to-cpp decompiler, and there's a number of things that I've run into, but this one in particular doesn't appear to have been addressed in any prior issues, so hopefully someone can point me in the right direction...

Currently there appears to be no way to determine what source file and line a global symbol belongs to, which particularly afflicts decompilation of some user datatypes. Not all PDB files have identifier data in the IPI stream, or any private user datatypes, but may have global symbols which have all of the type information that would typically be present in the IPI stream.

While it is possible to keep track of the previous module of some global symbols by way of iterating over the module contributions, this still does not help with telling us which file and line in the module's include hierarchy they originate from. How are we supposed to retrieve this data?

Any help would be appreciated, thanks!