• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 successful, then the sleep and
6# the signal sending is done
7SIG=$1
8shift
9PREFIX=$1
10shift
11SLEEP=$1
12shift
13GUARDCMD="$@"
14if [ "$GUARDCMD" = "" ]
15then
16  GUARDCMD="true"
17fi
18VPID=`./vgdb -l $PREFIX 2>&1 | awk '{print $2}' | sed -e 's/--pid=//'`
19if [ "$VPID" = "" ]
20then
21  echo "send_signal could not determine the valgrind pid with " $PREFIX
22  exit 1
23fi
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