Skip to content
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

Add Dwarf::load and Dwarf::borrow #406

Merged
merged 4 commits into from
Mar 13, 2019
Merged

Conversation

philipc
Copy link
Collaborator

@philipc philipc commented Mar 12, 2019

Use Dwarf::load in the read module example. See #405 for motivation. If users want to avoid loading some sections then they can handle that in the loader callback.

Dwarf::borrow can be used when the Reader needs to borrow from something else. In the dwarfdump example we use an arena, but instead of that we could first load everything into a Dwarf<Cow<[u8]>> and then borrow that to get Dwarf<EndianSlice<_>>. Note that this can't use the standard rust Borrow trait, and I couldn't come up with a way to define this as a Section trait method either (do we need type constructors or something like that?). I didn't update dwarfdump to use this because the arena is still convenient for the sections that aren't in Dwarf.

@coveralls
Copy link

coveralls commented Mar 12, 2019

Coverage Status

Coverage decreased (-0.4%) to 86.303% when pulling fb3f33e on philipc:dwarf-load into f1f641c on gimli-rs:master.

src/read/abbrev.rs Show resolved Hide resolved
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SectionId {
/// The `.debug_abbrev` section.
DebugAbbrev,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I was going to suggest adding this, but looks like you've anticipated it already :)

@philipc philipc merged commit f405ada into gimli-rs:master Mar 13, 2019
@philipc philipc deleted the dwarf-load branch March 13, 2019 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants