Due to timing problem, test was not properly testing.
What needs to be ensured is:
vgdb is attached (i.e. is ptracing valgrind)
2 sigusr1 signals are sent while vgdb is ptracing
vgdb will queue these signals
when continuing, the queued signals are delivered.
With 3.9.0, the above causes an internal error in valgrind:
valgrind: m_syswrap/syswrap-main.c:1436 (vgPlain_client_syscall): Assertion 'sci->status.what == SsIdle' failed.
It would be better to have explicit synchronisation in the test
rather than counting on 'sleep xxx' to have things done in the
order that tests the signal queueing.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13910 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/gdbserver_tests/nlvgdbsigqueue.stdinB.gdb b/gdbserver_tests/nlvgdbsigqueue.stdinB.gdb
index d0ad00b..d191934 100644
--- a/gdbserver_tests/nlvgdbsigqueue.stdinB.gdb
+++ b/gdbserver_tests/nlvgdbsigqueue.stdinB.gdb
@@ -8,8 +8,8 @@
shell ./simulate_control_c --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 1 grep main nlvgdbsigqueue.stderr.out
#
# send SIGUSR1/SIGUSR1 in a few seconds, when vgdb is attached
-shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 2
-shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 3
+shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 4
+shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 4
#
echo continuing to have vgdb interrupted by simulate_control_c\n
continue
@@ -17,7 +17,7 @@
# Now vgdb should have received the interrupt, and so has
# attached to the sleeping process.
# wait for the USR sig to be sent, that will be queued by vgdb.
-shell sleep 4
+shell sleep 8
# continue, so as to have vgdb sending queued signals when PTRACE_DETACHing
echo continuing to receive first SIGUSR1\n
continue
diff --git a/gdbserver_tests/nlvgdbsigqueue.stdoutB.exp b/gdbserver_tests/nlvgdbsigqueue.stdoutB.exp
index cbeeb89..9318334 100644
--- a/gdbserver_tests/nlvgdbsigqueue.stdoutB.exp
+++ b/gdbserver_tests/nlvgdbsigqueue.stdoutB.exp
@@ -1,14 +1,15 @@
continuing to have vgdb interrupted by simulate_control_c
Continuing.
-Program received signal SIGUSR1, User defined signal 1.
+Program received signal SIGTRAP, Trace/breakpoint trap.
0x........ in syscall ...
+sending signal
+sending signal
continuing to receive first SIGUSR1
Continuing.
-[New Thread ....]
Program received signal SIGUSR1, User defined signal 1.
0x........ in syscall ...
continuing to receive second SIGUSR1
Continuing.
-Program received signal SIGTRAP, Trace/breakpoint trap.
+Program received signal SIGUSR1, User defined signal 1.
0x........ in syscall ...
Kill the program being debugged? (y or n) [answered Y; input not from terminal]
diff --git a/gdbserver_tests/send_signal b/gdbserver_tests/send_signal
index 12440d0..d13e68e 100755
--- a/gdbserver_tests/send_signal
+++ b/gdbserver_tests/send_signal
@@ -14,4 +14,5 @@
exit 1
fi
(sleep $SLEEP
+ echo sending signal
kill -s $SIG $VPID) &