3 # by christian at jaeger mine nu, put into the public domain
4 # thanks go to tromey on #gdb
11 echo "usage: $myname outfile program arguments"
12 echo " runs program with arguments and outputs gdb log to"
13 echo " \${outfile}.log and the backtrace to \${outfile}_backtrace.txt"
23 logfile
="${outfile}.log"
24 backtracefile
="${outfile}_backtrace.txt"
33 moveold
"$backtracefile"
35 ##todo: can't use quotes in cmd files. but what about files with spaces?...
36 cat <<EOF > "$cmdfile"
38 set logging file $logfile
40 set logging redirect on
43 set logging redirect off
44 set logging file $backtracefile
46 set logging redirect on
51 gdb
-x "$cmdfile" -batch-silent --args "$program" "$@"
54 if [ "No stack." == "`cat "$backtracefile"`" ]; then
57 echo "$myname: application generated a backtrace" >&2
60 # produce a success/error exit code:
61 tail -1 "$logfile" |
grep --quiet "Program exited normally"