blob: 913eaa9dafe0bcb70c80f4a664887ba1e38e8222 [file] [log] [blame]
sewardj3b290482011-05-06 21:02:55 +00001#! /bin/sh
2
3# simulate control_c by sending SIGUSR1 to the vgdb using prefix $1 in $2 seconds
sewardj76291802011-05-31 07:09:06 +00004# If there are some args after $2, the rest of these args is a command and its arg
5# which is run every second. When this command is succesful, then the sleep and
6# the control c simul is done.
7PREFIX=$1
8shift
9SLEEP=$1
10shift
11GUARDCMD="$@"
12if [ "$GUARDCMD" = "" ]
13then
14 GUARDCMD="true"
15fi
16VGDBPID=`./vgdb -D $PREFIX 2>&1 | awk '/vgdb pid/ {print $3}'`
sewardj3b290482011-05-06 21:02:55 +000017if [ "$VGDBPID" = "" ]
18then
sewardj76291802011-05-31 07:09:06 +000019 echo "simulate_control_c could not determine the vgdb pid with " $PREFIX
sewardj3b290482011-05-06 21:02:55 +000020 exit 1
21fi
sewardj76291802011-05-31 07:09:06 +000022(while ! $GUARDCMD >> garbage.filtered.out 2>&1
23 do
24 sleep 1
25 done
26 sleep $SLEEP
27 kill -10 $VGDBPID) &