Introduce old redir program
[lcapit-junk-code.git] / scripts / gdb-get-bt
blob6a398fa4e6a4e5d90e89634b9952841ae74e852d
1 #!/bin/sh
3 # Print the stack backtrace of a crashed program
5 # Luiz Fernando N. Capitulino <lcapitulino@gmail.com>
7 CORE=$2
8 BINARY=$1
10 usage()
12 echo "getbt: Print the stack backtrace of a crashed program"
13 echo "Usage: $(basename $0) < program > < core-file >"
16 if [ $# -eq 0 ]; then
17 usage
18 exit 1
21 if [ "$1" = "-h" -o "$1" = "--help" ]; then
22 usage
23 exit 0
26 # print only the trace
27 gdb -nx -silent $BINARY $CORE <<<bt | egrep '^#'