1 # connect gdb to Valgrind gdbserver:
2 target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-nlcontrolc
3 echo vgdb launched process attached\n
4 monitor v.set vgdb-error 999999
7 # simulate control-c in a few seconds
8 shell ./simulate_control_c --vgdb-prefix=./vgdb-prefix-nlcontrolc 1 grep main nlcontrolc.stderr.out
12 # Threads are burning cpu now
13 # We would like to fully test info threads here, but which thread are Runnable
14 # or Yielding is unpredictable. With a recent enough gdb, check the nr of
15 # threads by state using pipe commands and grep/wc.
16 init-if-undefined $_gdb_major = 0
17 init-if-undefined $_gdb_minor = 0
19 | info threads | grep VgTs_Runnable | wc -l
20 | info threads | grep VgTs_Yielding | wc -l
25 # We change the variables so that all the threads are blocked in a syscall
30 shell ./simulate_control_c --vgdb-prefix=./vgdb-prefix-nlcontrolc 1 grep changed nlcontrolc.stdoutB.out
32 echo changed burning parameters to sleeping parameters\n
34 # Here, all tasks should be blocked in a loooonnnng select, all in WaitSys
36 # We reset the sleepms to 0. The threads should still be blocked in the syscall
38 shell ./simulate_control_c --vgdb-prefix=./vgdb-prefix-nlcontrolc 1 grep reset nlcontrolc.stdoutB.out
40 echo reset to sleeping parameters\n
42 # threads should still be blocked in a loooonnnng select, all in WaitSys
45 | info threads | grep VgTs_WaitSys | wc -l
49 # Make the process die.