gary
gary

Reputation: 1649

Why do I not get a backtrace when my program has a segmentation fault even though RUST_BACKTRACE=1 is set?

I want to see the backtrace of a random segmentation fault, so I set the RUST_BACKTRACE=1 environment variable. Normally it prints the backtrace info, but this time it doesn't. Why doesn't RUST_BACKTRACE work?

$ RUST_BACKTRACE=1 ./target/debug/grin-miner
...
Segmentation fault: 11

I have tried multiple times and always get no backtraces. If the error is in external libraries, will RUST_BACKTRACE do the job or not?

Upvotes: 5

Views: 3188

Answers (1)

Shepmaster
Shepmaster

Reputation: 430891

RUST_BACKTRACE only prints out a backtrace for Rust-generated panics. A segfault is a lower-level failure than a panic. You will need to use a debugger (GDB, LLDB, WinDbg, etc.) to investigate the failure.

Upvotes: 6

Related Questions