-
Notifications
You must be signed in to change notification settings - Fork 313
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
wip: bpftool but with aya #902
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Dave Tucker <[email protected]>
✅ Deploy Preview for aya-rs-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat. Would be good to mention motivation of course.
Reviewed 6 of 7 files at r1, all commit messages.
Reviewable status: 6 of 7 files reviewed, 12 unresolved discussions
aya-tool/Cargo.toml
line 12 at r1 (raw file):
[dependencies] aya-obj = { version = "0.1.0", path = "../aya-obj", features = ["std"] }
do we need to state the version?
aya-tool/src/bin/aya-tool.rs
line 27 at r1 (raw file):
bindgen_args: Vec<String>, }, /// Pretty print an ELF file's BTF
FYI there is https://github.com/anakryiko/btfdump. I didn't realize you were doing this until I got here in the review, it wasn't clear from the title
aya-tool/src/btf.rs
line 6 at r1 (raw file):
use std::{fmt::Write, path::Path}; pub fn print_btf<P: AsRef<Path>>(path: P) -> anyhow::Result<()> {
can this take an impl io::Write
and avoid all the intermediate allocations?
aya-obj/src/btf/types.rs
line 85 at r1 (raw file):
} } /// The target type of the const.
newline before this
aya-obj/src/btf/types.rs
line 410 at r1 (raw file):
} /// The integer size.
why not the same "The of the " phrasing you use elsewhere?
aya-obj/src/btf/types.rs
line 425 at r1 (raw file):
} /// The size of the integer in bits.
this isn't the size
aya-obj/src/btf/types.rs
line 611 at r1 (raw file):
impl BtfMember { /// The offset of the members name in the BTF string section.
member's
aya-obj/src/btf/types.rs
line 706 at r1 (raw file):
} /// Vlen
?
aya-obj/src/btf/types.rs
line 837 at r1 (raw file):
} pub fn index_type(&self) -> u32 {
missing docs below this point.
aya-obj/src/btf/types.rs
line 1480 at r1 (raw file):
} /// Returns the name offset of the BTF type.
these comments start with "Returns" but the others do not
aya-obj/src/btf/btf.rs
line 339 at r1 (raw file):
use object::{Object, ObjectSection}; let path = path.as_ref(); let bin_data = std::fs::read(path).map_err(|e| BtfError::FileError {
nit: call this error to avoid the colon below
aya-obj/src/btf/btf.rs
line 343 at r1 (raw file):
error: e, })?; let obj_file = object::File::parse(&*bin_data).map_err(|_| BtfError::Elf)?;
can we avoid throwing away the error?
aya-obj/src/btf/btf.rs
line 347 at r1 (raw file):
.section_by_name(".BTF") .ok_or_else(|| BtfError::InvalidHeader)?; let data = section.data().map_err(|_| BtfError::InvalidHeader)?;
can we avoid throwing away the error?
The motivation was:
This is just a quick hack, but it's open to be carried if others see value in having this here. |
This all makes sense to me. I'm supportive of carrying forward, particularly for the last mentioned goal which seems extremely valuable. |
This change is