philippe | 6654de8 | 2014-04-15 22:35:23 +0000 | [diff] [blame] | 1 | # connect gdb to Valgrind gdbserver: |
| 2 | target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue |
| 3 | echo vgdb launched process attached\n |
| 4 | monitor v.set vgdb-error 999999 |
| 5 | # |
| 6 | # |
philippe | 41d3111 | 2014-04-26 20:01:28 +0000 | [diff] [blame] | 7 | # simulate control-c 1 second after having seen sleepers program outputting 'main' |
philippe | 6654de8 | 2014-04-15 22:35:23 +0000 | [diff] [blame] | 8 | shell ./simulate_control_c --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 1 grep main nlvgdbsigqueue.stderr.out |
| 9 | # |
philippe | 41d3111 | 2014-04-26 20:01:28 +0000 | [diff] [blame] | 10 | # send SIGUSR1/SIGUSR1 in a few seconds, after vgdb has attached |
| 11 | # vgdb will attach when it will receive the control-c |
philippe | 6f3f859 | 2014-04-26 20:23:47 +0000 | [diff] [blame] | 12 | shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 0 grep attachedwaitingforsigusr1 nlvgdbsigqueue.stdoutB.out |
philippe | c16b2a1 | 2014-04-27 08:23:17 +0000 | [diff] [blame] | 13 | shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 1 grep attachedwaitingforsigusr1 nlvgdbsigqueue.stdoutB.out |
philippe | 6654de8 | 2014-04-15 22:35:23 +0000 | [diff] [blame] | 14 | # |
| 15 | echo continuing to have vgdb interrupted by simulate_control_c\n |
| 16 | continue |
| 17 | # |
| 18 | # Now vgdb should have received the interrupt, and so has |
| 19 | # attached to the sleeping process. |
| 20 | # wait for the USR sig to be sent, that will be queued by vgdb. |
philippe | 6f3f859 | 2014-04-26 20:23:47 +0000 | [diff] [blame] | 21 | echo attachedwaitingforsigusr1\n |
| 22 | # send_signal tries every second the guardcmd |
| 23 | # so we must now wait to be (somewhat) sure the 2 SIGUSR1 are emitted |
philippe | c16b2a1 | 2014-04-27 08:23:17 +0000 | [diff] [blame] | 24 | shell sleep 4 |
philippe | 6654de8 | 2014-04-15 22:35:23 +0000 | [diff] [blame] | 25 | # continue, so as to have vgdb sending queued signals when PTRACE_DETACHing |
| 26 | echo continuing to receive first SIGUSR1\n |
| 27 | continue |
| 28 | # simulate a control c to afterwards stop the execution |
| 29 | shell ./simulate_control_c --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 1 |
| 30 | echo continuing to receive second SIGUSR1\n |
| 31 | continue |
| 32 | kill |
| 33 | quit |