Skip to content

Instantly share code, notes, and snippets.

@jwilm
Forked from kmcallister/rust-backtrace
Created January 16, 2016 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwilm/2cd6f6b1580588b773ea to your computer and use it in GitHub Desktop.
Save jwilm/2cd6f6b1580588b773ea to your computer and use it in GitHub Desktop.
Run a Rust program and print a stack backtrace on failure (old)
#!/bin/bash
### NOTE ### You probably don't need this anymore!
# Just set RUST_BACKTRACE=1
# Usage: rust-backtrace ./my-rust-prog args...
exec gdb -batch -n -x /dev/fd/3 --args "$@" 3<<ENDGDB
set height 0
set breakpoint pending on
break rust_fail
commands 1
thread apply all backtrace
quit
end
run
ENDGDB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment