More gdbserver test fixes, from #214909 c 101:
fix mcsig(no)pass on arm Ubuntu10, arm thumb internal doc, improve
simulate_control_c

* new file docs/internals/arm_thumb_notes_gdbserver.txt
  documentation about the subtilities of the thumb bit handling in gdbsrv.
* made the SIGFPE backtrace filtering less dependent on gdb/os/libc/...
* improved simulate_control_c : runs faster/less dependent on timeout value


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11791 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/gdbserver_tests/simulate_control_c b/gdbserver_tests/simulate_control_c
index cea1e59..913eaa9 100755
--- a/gdbserver_tests/simulate_control_c
+++ b/gdbserver_tests/simulate_control_c
@@ -1,11 +1,27 @@
 #! /bin/sh
 
 # simulate control_c by sending SIGUSR1 to the vgdb using prefix $1 in $2 seconds
-VGDBPID=`./vgdb -D $1 2>&1 | awk '/vgdb pid/ {print $3}'`
+# If there are some args after $2, the rest of these args is a command and its arg
+# which is run every second. When this command is succesful, then the sleep and
+# the control c simul is done.
+PREFIX=$1
+shift
+SLEEP=$1
+shift
+GUARDCMD="$@"
+if [ "$GUARDCMD" = "" ]
+then
+  GUARDCMD="true"
+fi
+VGDBPID=`./vgdb -D $PREFIX 2>&1 | awk '/vgdb pid/ {print $3}'`
 if [ "$VGDBPID" = "" ]
 then
-  echo "simulate_control_c could not determine the vgdb pid with " $1
+  echo "simulate_control_c could not determine the vgdb pid with " $PREFIX
   exit 1
 fi
-(sleep $2; kill -10 $VGDBPID) &
-
+(while ! $GUARDCMD >> garbage.filtered.out 2>&1
+ do
+   sleep 1
+ done
+ sleep $SLEEP
+ kill -10 $VGDBPID) &