forked from gimli-rs/gimli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Often, consumers of a DWARF file will want to know if a given function has an attribute, either directly or indirectly. Currently, finding that information is tedious and prone to error. Add a helper function in gimli to make this easier. This does not attempt to have the maximum possible performance; consumers who care about that can still implement the logic themselves. In particular, the caches are recalculated each time `shared_attrs` is called, introducing an allocation. The logic works roughly as follows (inspired by [addr2line::Function::parse_children](https://github.com/gimli-rs/addr2line/blob/28ba2d45f2d22134915f55b46ddd6a039559366b/src/function.rs#L278)): - Create a cache of all DWARF units known to the `UnitRef` - Given an entry offset, iterate over all its attributes and pass them to a callback chosen by the caller. - For each indirect attribute, such as `DW_AT_abstract_origin`, follow the pointer to the abstract source and do the same thing again there. I have tested this downstream (see [rust-lang/rust#134831](rust-lang/rust#134831)), but I have not yet added unit tests. Let me know how you would like this to be tested.
- Loading branch information
Showing
1 changed file
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters