summaryrefslogtreecommitdiff
path: root/selftest/gdb_run
blob: 4cc26dd8dc182ee410030865e53606a6342f6d97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

ENV="$1"

shift 1

TMPFILE=$(mktemp --tmpdir gdb_run.XXXXXXXXXX)
test -n "${TMPFILE}" || {
	echo "mktemp doesn't work" 1>&2
	exit 1
}

cat <<EOF >$TMPFILE
run
bt
EOF

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