Provide access to inner `goblin` object types from `..Object` structs
Unless I missed something in the docs, this doesn't seem possible right now. This would pair naturally with the existing data() accessors that exist, which provide access to the (unparsed) raw file data.
For example, this would imply an accessor method to the private field PeObject.pe.
Motivation
Here's a motivating situation:
- I've parsed a buffer into an
ObjectviaObject::parse() - I have recognized that the
Objectvariant is anObject::Pe, containing aPeObject - I'd like to access the raw CodeView data in the PE (if present), as part of searching for the PDB using
SymFindFileInPathW.
Notably, SymFindFileInPathW takes the signature and age as search parameters.
Workarounds
Now, the above example almost has workaround solutions in PeObject. I can use PeObject::debug_file_name(), and the signature and age are partially encoded in the DebugId available via PeObject::debug_id() (though it looks like the signature itself gets truncated).
But in general, what'd I'd always prefer is the ability to leverage the lower-level parsed PE from goblin. Then I'm free to query extremely format-specific data, without burdening the API of the Object structs in symbolic.
I'd be happy to open a PR for this, if it sounds reasonable. I think the main question is how you'd like the new public accessor methods to be named!
Ideally symbolic would be independant of the underlying object parsing library, meaning that we shouldn’t expose that. Exposing that also means its types become part of our public API, meaning that we would have to do a major version release everytime we want to update to another semver major of goblin.
However I see that we already re-export something from goblin here, which is unfortunate :-(
https://github.com/getsentry/symbolic/blob/283afaac99f22039c84f7467964a0f996835c4bc/symbolic-debuginfo/src/pe.rs#L16-L17
I think this is a valid usecase, but rather not something specific for symbolic. We would like to hide the exact implementation details as much as possible.
I would recommend just using goblin directly, or maybe https://github.com/gimli-rs/object.