4

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?

  • 2
    "If the error is in the external libraries, RUST_BACKTRACE will do the job or not?", I don't think, rust will show you the backtrace when it's panic, but a segfault will stop your program. try vagrind ./target/debug/grin-miner – Stargateur May 22 '18 at 2:33
6

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.

  • Thanks Shepmaster. I switch to lldb and get the backtraces. $ rust-lldb ./target/debug/grin-miner and then when Segmentation fault happen, input thread backtrace – gary May 22 '18 at 2:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.