Slightly prettier output

This commit is contained in:
Gwilym Inzani 2024-04-01 14:10:23 +01:00
parent 3f374f3e9c
commit 726b400463
2 changed files with 8 additions and 1 deletions

View file

@ -14,6 +14,7 @@ addr2line = { version = "0.21", default-features = false, features = [
"rustc-demangle", "rustc-demangle",
"std-object", "std-object",
] } ] }
colored = "2"
[profile.dev] [profile.dev]
opt-level = 3 opt-level = 3

View file

@ -2,6 +2,7 @@ use std::{fs, path::PathBuf};
use addr2line::{gimli, object}; use addr2line::{gimli, object};
use clap::Parser; use clap::Parser;
use colored::Colorize;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[command(version, about, long_about = None)] #[command(version, about, long_about = None)]
@ -65,7 +66,12 @@ fn print_address(ctx: &addr2line::Context<impl gimli::Reader>, address: u64) ->
}) })
.unwrap_or_default(); .unwrap_or_default();
println!("{function_name} ({}:{})", location.filename, location.line); println!(
"{}\n\t{}:{}",
function_name.white(),
location.filename.green(),
location.line.to_string().green()
);
} }
Ok(()) Ok(())