4 个版本 (2 个破坏性更新)

0.3.0 2023年1月24日
0.2.0 2022年7月1日
0.1.1 2020年11月4日
0.1.0 2020年11月4日

#431调试

Download history 3404/week @ 2024-04-23 2812/week @ 2024-04-30 4104/week @ 2024-05-07 4261/week @ 2024-05-14 2225/week @ 2024-05-21 2685/week @ 2024-05-28 1776/week @ 2024-06-04 2835/week @ 2024-06-11 3396/week @ 2024-06-18 2891/week @ 2024-06-25 2413/week @ 2024-07-02 2815/week @ 2024-07-09 1195/week @ 2024-07-16 3510/week @ 2024-07-23 2466/week @ 2024-07-30 3411/week @ 2024-08-06

11,123 每月下载次数
用于 11 个包 (3 个直接使用)

MIT/Apache

8KB

堆栈溢出时回溯

默认情况下,Rust 在堆栈溢出时不会打印回溯而直接终止

λ bat src/main.rs
fn main() {
    f(92)
}

fn f(x: u64) {
    f(x)
}
λ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/so`

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
fish: Job 1, 'cargo run' terminated by signal SIGABRT (Abort)

此包修复了这个问题

λ bat src/main.rs
fn main() {
    unsafe { backtrace_on_stack_overflow::enable() };
    f(92)
}

fn f(x: u64) {
    f(x)
}
λ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/so`
Stack Overflow:
   0: backtrace_on_stack_overflow::handle_sigsegv
             at /home/matklad/p/backtrace-on-stack-overflow/src/lib.rs:33:40
   1: <unknown>
   2: so::f
             at src/main.rs:6
   3: so::f
             at src/main.rs:7:5
   4: so::f
             at src/main.rs:7:5
   5: so::f
             at src/main.rs:7:5
   6: so::f
             at src/main.rs:7:5
   7: so::f
             at src/main.rs:7:5
   8: so::f
             at src/main.rs:7:5
   9: so::f
             at src/main.rs:7:5
  10: so::f
             at src/main.rs:7:5

此包适用于调试,但不适合在生产环境中启用。

依赖项

~5MB
~106K SLoC