Follow-up for r15381
[valgrind.git] / gdbserver_tests / send_signal
blob3f4442f8031b1579505e9aef912b539483b26d8b
1 #! /bin/sh
3 # send_signal sends signal $1 to the Valgrind process using prefix $2 in $3 seconds
4 # If there are some args after $3, 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 signal sending is done
7 SIG=$1
8 shift
9 PREFIX=$1
10 shift
11 SLEEP=$1
12 shift
13 GUARDCMD="$@"
14 if [ "$GUARDCMD" = "" ]
15 then
16 GUARDCMD="true"
18 VPID=`./vgdb -l $PREFIX 2>&1 | awk '{print $2}' | sed -e 's/--pid=//'`
19 if [ "$VPID" = "" ]
20 then
21 echo "send_signal could not determine the valgrind pid with " $PREFIX
22 exit 1
24 (while ! $GUARDCMD >> garbage.filtered.out 2>&1
26 sleep 1
27 done
28 sleep $SLEEP
29 echo sending signal
30 kill -s $SIG $VPID) &