mirror of
https://github.com/Noratrieb/my-binary-is-thicc-af.git
synced 2026-01-16 04:35:06 +01:00
run instruction
This commit is contained in:
parent
321af3e846
commit
c50057a145
2 changed files with 18 additions and 1 deletions
|
|
@ -17,6 +17,8 @@ fn main() -> Result<()> {
|
|||
.nth(1)
|
||||
.unwrap_or("./target/debug/my-binary-is-thicc-af".into());
|
||||
|
||||
let limit = 10;
|
||||
|
||||
let data = std::fs::read(&path).wrap_err_with(|| format!("error opening `{path}`"))?;
|
||||
let object = object::File::parse(data.as_slice()).context("could not parse object file")?;
|
||||
|
||||
|
|
@ -54,7 +56,11 @@ fn main() -> Result<()> {
|
|||
let mut root_groups = Groups(HashMap::new());
|
||||
|
||||
for (sym, size) in symbol_sizes {
|
||||
let components = symbol_components(sym).with_context(|| sym.to_string())?;
|
||||
let mut components = symbol_components(sym).with_context(|| sym.to_string())?;
|
||||
|
||||
if components.len() > limit {
|
||||
components.truncate(limit);
|
||||
}
|
||||
|
||||
add_to_group(&mut root_groups, components, size);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue