1#!/bin/sh 2 3# attaches GDB to a process to dump a core 4 5# we want everything on stderr, so the program is not disturbed 6exec 1>&2 7 8PID=$1 9TMPFILE=/tmp/gdb.$$ 10COREFILE="ap-$$.core" 11cat << EOF > $TMPFILE 12set height 0 13generate-core-file $COREFILE 14quit 15EOF 16gdb -n -batch -x $TMPFILE --pid $PID < /dev/null 2>&1 17rm -f $TMPFILE 18 19