-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API improvements for third-party tools #89
Comments
Thanks @landaire for opening this issue! Improvements and contributions are much welcome.
You're right; both of these are oversights and should definitely be updated. If you like, feel free to create a PR, or let me know if you'd like me to fix this.
You're right, this API is currently missing. The issue with adding such an API was that there is no efficient way to provide random access to a module by index, that I'm currently aware of. Ultimately, it looks like this:
The "solution" to this was to pass the burden of loading and indexing modules to the user. For instance, we've built a type that collects all module entries ahead of time into a vector and then lazy loads the module on first access. At the time, I believed this is a bit too high level for the PDB crate, but I'm happy to reconsider and add a convenience type that takes care of this. This gets even worse when you look at the
You're right. We were able to implement these efficiently due to a difference in what the indexes actually are. While the module index is in fact the numeric index of the module in the stream, the |
Thanks for the feedback!
Are the modules indexed in order of how they're processed by the iterator? If so, that's trivial for me to handle in my own code and don't mind doing it myself -- I just didn't know if that was guaranteed to match. |
This is my understanding, yes. To compare with how Microsoft's PDB code works:
So I think it should be safe to assume that you can take |
All points in this PR are now addressed, with the exception of |
Sorry for the "mega issue" but I had a couple of questions/comments regarding the current API design and if certain changes would be welcome. I wrote a tool this weekend that I intend to improve upon for exposing some of the interesting PDB metadata that this library exposes: https://github.com/landaire/pdbview
There were two changes/workarounds I had to make in my own local branch for this tool:
CompileFlags
fields are not public, essentially making the struct useless: landaire@62aedc0constants
module are exposed through public APIs but the module itself is not (e.g. CPUType). This is somewhat awkward as you cannot explicitly import this type into your own code and cannot read documentation for these types (see: https://docs.rs/pdb/0.6.0/pdb/struct.CompileFlagsSymbol.html#structfield.cpu_type). My workaround here was to just format these as Strings since that was all I need anyways.These two issues I'd be happy to make PRs for if the intent is for these items to be public.
The next issue I encountered was that the
ProcedureReferenceSymbol
is sort of useless if you actually want to do anything with it. In order to look up the symbol you need to look up the correct module -- the ID of which can be obtained from themodule
field. From here I'm stumped. There's no way to get aModule
from a module index. Other similar scenarios use custom types, such asSymbolIndex
, and allow you to use methods such asModuleInfo::symbols_at(index)
to grab the symbol orSymbolIter::seek
. As far as I could tell no such APIs exist for modules and none of the examples or internal code reference these fields.The text was updated successfully, but these errors were encountered: