1 # Copyright (C) 2010-2017 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 if { ![support_displaced_stepping] } {
17 unsupported "displaced stepping"
21 load_lib gdb-python.exp
24 set pyfile ${srcdir}/${subdir}/py-events.py
26 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
30 save_vars { GDBFLAGS } {
31 append GDBFLAGS " -ex \"set non-stop on\""
32 clean_restart $testfile
35 if { [skip_python_tests] } { continue }
37 gdb_test_no_output "source ${pyfile}" "load python file"
39 gdb_test "test-events" "Event testers registered."
42 gdb_breakpoint "thread2"
43 gdb_breakpoint "thread3"
46 set test "run to breakpoint 1"
47 gdb_test_multiple "" $test {
48 -re "event type: stop\r\nstop reason: breakpoint\r\nfirst breakpoint number: 1\r\nbreakpoint number: 1\r\nthread num: 1\r\n.*$gdb_prompt $" {
51 -re "The target does not support running in non-stop mode" {
52 unsupported "non-stop mode is unsupported"
57 gdb_test "next" "event type: stop\r\nstop reason: breakpoint\r\nfirst breakpoint number: 2\r\nbreakpoint number: 2\r\nthread num: 2.*" "reached breakpoint 2"
59 gdb_test "thread 2" {\[Switching to thread 2 .*}
61 gdb_test "next" "event type: stop\r\nstop reason: breakpoint\r\nfirst breakpoint number: 3\r\nbreakpoint number: 3\r\nthread num: 3.*" "reached breakpoint 3"
63 gdb_test "thread 3" {\[Switching to thread 3 .*}
65 set test "continue thread 1"
66 gdb_test_multiple "continue&" $test {
67 -re "event type: continue\r\nthread num: 3\r\n$gdb_prompt " {
68 # This expect string must not expect the end-of-buffer '$'.
73 set test "thread 3 was signaled"
74 gdb_test_multiple "" $test {
75 -re "event type: stop\r\nstop reason: signal\r\nstop signal: SIGUSR1\r\nthread num: 3\r\nevent type: stop\r\n" {