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

Allow access to LoadCommandData's internal data #449

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

roblabla
Copy link
Contributor

This makes it easier to access some of the loadcommand structures. For instance, DylibCommand contains an LcStr, which is defined as an offset from the start of the loadcommand, and is contained within the loadcommand data.

With the raw_data() function, we could trivially access it from a LoadCommandData by doing

let cmd: LoadCommandData = todo!();
let dylib = cmd.dylib().unwrap();
let dylib_name = cmd.raw_data.get(dylib.dylib.name.offset.get(endian)..);

Copy link
Contributor

@philipc philipc left a comment

Choose a reason for hiding this comment

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

This is fine, but it's worth considering whether additional helpers for parsing would be useful. Note that LoadCommandData::string can be used for the LcStr.

@philipc philipc merged commit 404ae26 into gimli-rs:master Jul 20, 2022
vthib pushed a commit to vthib/boreal-object that referenced this pull request Nov 19, 2022
mcbegamerxx954 pushed a commit to mcbegamerxx954/object that referenced this pull request Jun 15, 2024
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.

2 participants