gdb_run 271 Bytes
Newer Older
1 2
#!/bin/sh

3 4 5 6
ENV="$1"

shift 1

7 8 9 10 11
TMPFILE=`mktemp --tmpdir gdb_run.XXXXXXXXXX`
test -n "${TMPFILE}" || {
	echo "mktemp doesn't work" 1>&2
	exit 1
}
12 13 14 15 16 17 18 19 20

cat << EOF  > $TMPFILE
run
bt
EOF

trap "/bin/rm -f $TMPFILE" EXIT
CMD="gdb -x $TMPFILE --args $@"
echo $CMD
21
eval $ENV "$CMD"