#!/bin/bash # idea is to run gdb like this: # debug program program-args # instead of the usual core file arguments which i don't use CMD=`tempfile -p gdb-` PROGRAM=$1 shift # hack to remove emacs's flags while [ -n "$1" ]; do if [ "$1" == "-cd" ]; then DRGS="$DRGS $1 $2" shift shift elif [ "$1" == "-fullname" ]; then DRGS="$DRGS $1" shift else ARGS="$ARGS $1" shift fi done echo "gdb: $DRGS" echo "prog: $PROGRAM" echo "args: $ARGS" cat >$CMD <