Getting backtrace on stackoverflow

At the moment, if a rust thread overflows it's stack, the message is not very helpful:

14:34:22|~/projects/rust-analyzer|master✓
λ env RUST_BACKTRACE=short ./target/ra_cli analysis-bench --highlight crates/ra_hir_def/src/nameres/collector.rs
loading: 213.214098ms

from scratch:   
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
fish: “env RUST_BACKTRACE=short ./targ…” terminated by signal SIGABRT (Abort)

Is there some crate that I can use to print a backtrace when an overflow happens?

This message is printed from a signal handler using an alternate stack. This context is limited in what it may do, e.g. calling only async-signal-safe libc functions (not even malloc!), so I doubt a real backtrace is possible from there.

I would run under a debugger and get a backtrace from there.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.