Open smessmer opened 1 week ago
I set up a sample panic somewhere in my code base, ran with cargo run --release, and caught it with the following custom panic handler:
cargo run --release
pub fn show_backtrace_on_panic() { std::panic::set_hook(Box::new(|panic_info| { let backtrace = std::backtrace::Backtrace::force_capture(); eprintln!("{panic_info}"); eprintln!("\nBacktrace:\n{backtrace}"); })); }
Which showed me this backtrace:
Backtrace: 0: cryfs_cli_utils::panic_handler::show_backtrace_on_panic::{{closure}} 1: std::panicking::rust_panic_with_hook 2: std::panicking::begin_panic_handler::{{closure}} 3: std::sys_common::backtrace::__rust_end_short_backtrace 4: rust_begin_unwind 5: core::panicking::panic_fmt 6: cryfs_cryfs::config::encryption::decrypt 7: cryfs_cryfs::config::loader::load_or_create 8: <cryfs_cli::cli::Cli as cryfs_cli_utils::application::Application>::main 9: cryfs_cli_utils::application::run 10: std::sys_common::backtrace::__rust_begin_short_backtrace 11: main 12: __libc_start_call_main at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16 13: __libc_start_main_impl at ./csu/../csu/libc-start.c:360:3 14: _start
Frames 0..=5 are useless here, but starting from frame 6, the frames are relevant.
0..=5
However, using human-panic, I got this backtrace, which skips frame 6:
human-panic
"backtrace" = """ 0: 0x57a214f25d51 - cryfs_cryfs::config::loader::load_or_create::h0164e15f3c7e3b2f 1: 0x57a214eba0f8 - <cryfs_cli::cli::Cli as cryfs_cli_utils::application::Application>::main::h857c34904cb9b5d6 2: 0x57a214d42d65 - cryfs_cli_utils::application::run::h524b32ee2ef4b9b3 3: 0x57a214d399c3 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha12c550ae26c7977 4: 0x57a214d3a260 - main 5: 0x79c6fac2a1ca - __libc_start_call_main at ./csu/../sysdeps/nptl/libc_start_call_main.h:58 6: 0x79c6fac2a28b - __libc_start_main_impl at ./csu/../csu/libc-start.c:360 7: 0x57a214c81455 - _start 8: 0x0 - <unresolved>"""
Seems like it's skipping one frame too many.
I set up a sample panic somewhere in my code base, ran with
cargo run --release
, and caught it with the following custom panic handler:Which showed me this backtrace:
Frames
0..=5
are useless here, but starting from frame 6, the frames are relevant.However, using
human-panic
, I got this backtrace, which skips frame 6:Seems like it's skipping one frame too many.