Home | History | Annotate | Download | only in gdbserver_tests
      1 #! /bin/sh
      2 
      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"
     17 fi
     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
     23 fi
     24 (while ! $GUARDCMD >> garbage.filtered.out 2>&1
     25  do
     26    sleep 1
     27  done
     28  sleep $SLEEP
     29  echo sending signal
     30  kill -s $SIG $VPID) &
     31