Skip to content

Commit

Permalink
objdump: print the Build ID as a string when valid
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed May 22, 2023
1 parent 4b9c9da commit 88462a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/examples/src/objdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ fn dump_parsed_object<W: Write, E: Write>(w: &mut W, e: &mut E, file: &object::F
Err(err) => writeln!(e, "Failed to parse Mach UUID: {}", err)?,
}
match file.build_id() {
Ok(Some(build_id)) => writeln!(w, "Build ID: {:x?}", build_id)?,
Ok(Some(build_id)) => match std::str::from_utf8(build_id) {
Ok(build_id) => writeln!(w, "Build ID: {}", build_id)?,
Err(std::str::Utf8Error { .. }) => writeln!(w, "Build ID: {:x?}", build_id)?,
},
Ok(None) => {}
Err(err) => writeln!(e, "Failed to parse build ID: {}", err)?,
}
Expand Down

0 comments on commit 88462a7

Please sign in to comment.