#!/bin/sh prog=`basename $0` if test $# -lt 1; then echo "Usage: $prog " exit 0 fi PID=`/bin/ps -C "$1" -o pid=` if test "x$PID" != "x"; then echo "$prog: Starting 'gdb $1 $PID' ..." gdb "$1" $PID 2>&1 | tee "gdb-$PID.log" else echo "$prog: Could not find running instance of '$1'." fi