Skip to content

Instantly share code, notes, and snippets.

@kmcallister
Last active January 16, 2016 05:47
Show Gist options
  • Save kmcallister/7047619 to your computer and use it in GitHub Desktop.
Save kmcallister/7047619 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
backtrace
quit
end
run
ENDGDB
@kmcallister
Copy link
Author

Replace backtrace with thread apply all backtrace to get a stack from every thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment