~taiite/protodump

8b297bb2286ce23f37a927bb7a8900052eeb79af — Hubert Hirtz 1 year, 5 months ago 47a321a
Print header on stderr
1 files changed, 13 insertions(+), 10 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +13 -10
@@ 70,14 70,14 @@ impl PartialEq for ObjectInfo<'_> {

fn show_object_info_diff(prev: &ObjectInfo<'_>, next: &ObjectInfo<'_>) {
    if prev.container_type != next.container_type {
        println!(
        eprintln!(
            "Container type: {} {}",
            Paint::red(format_args!("-{:?}", prev.container_type)),
            Paint::green(format_args!("+{:?}", next.container_type)),
        );
    }
    if prev.is_little_endian != next.is_little_endian {
        println!(
        eprintln!(
            "Endianness: {} {}",
            Paint::red(format_args!(
                "-{}",


@@ 467,7 467,7 @@ fn main() -> Result<()> {
    });

    if let Some(baseline_path) = matches.opt_str("d") {
        let baseline = fs::File::open(baseline_path).context("failed to open diff baseline")?;
        let baseline = fs::File::open(&baseline_path).context("failed to open diff baseline")?;
        let baseline_contents =
            unsafe { memmap::Mmap::map(&baseline).context("failed to mmap diff baseline")? };
        let baseline_obj = object::File::parse(baseline_contents.as_ref())


@@ 502,7 502,10 @@ fn main() -> Result<()> {

        let d = diff_sources(baseline_sources, sources);
        if !d.subprogram_diffs.is_empty() {
            println!();
            if !is_match {
                // Print a line between the object info diff and the source diff.
                eprintln!();
            }
            show_source_diff(&d);
        }
        is_match = is_match && d.subprogram_diffs.is_empty();


@@ 513,19 516,19 @@ fn main() -> Result<()> {
            process::exit(1);
        }
    } else {
        println!("OBJECT FILE {}", path);
        println!("Container type: {:?}", object_info.container_type);
        eprintln!("OBJECT FILE {}", path);
        eprintln!("Container type: {:?}", object_info.container_type);
        if object_info.is_little_endian {
            println!("Endianness: little");
            eprintln!("Endianness: little");
        } else {
            println!("Endianness: big");
            eprintln!("Endianness: big");
        }
        let skipped = object_info.symbol_whitelist.len() - sources.subprograms.len();
        if skipped != 0 {
            println!("Symbols with missing debug info: {}", skipped);
            eprintln!("Symbols with missing debug info: {}", skipped);
        }
        if !sources.subprograms.is_empty() {
            println!();
            eprintln!();
            show_prototypes(sources);
        }
    }