Fix scripted probe breakpoints
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-evthreads.exp
CommitLineData
42a4f53d 1# Copyright (C) 2010-2019 Free Software Foundation, Inc.
c17a9e46
HZ
2
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.
7#
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.
12#
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/>.
15
d5b4a7be
YQ
16if { ![support_displaced_stepping] } {
17 unsupported "displaced stepping"
18 return -1
19}
20
c17a9e46
HZ
21load_lib gdb-python.exp
22
b4a58790 23standard_testfile
c17a9e46 24
0935723e
JK
25if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
26 return -1
27}
42f1b161
PA
28
29save_vars { GDBFLAGS } {
30 append GDBFLAGS " -ex \"set non-stop on\""
31 clean_restart $testfile
32}
c17a9e46
HZ
33
34if { [skip_python_tests] } { continue }
35
74c2c1f4 36set pyfile [gdb_remote_download host ${srcdir}/${subdir}/py-events.py]
72ca0410 37gdb_test_no_output "source ${pyfile}" "load python file"
c17a9e46 38
314bb8c3 39gdb_test "test-events" "Event testers registered."
c17a9e46
HZ
40
41gdb_breakpoint "main"
42gdb_breakpoint "thread2"
43gdb_breakpoint "thread3"
44
0935723e 45gdb_run_cmd
bc6c7af4 46set test "run to breakpoint 1"
0935723e 47gdb_test_multiple "" $test {
5068630a 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 $" {
0935723e 49 pass $test
c17a9e46 50 }
0935723e
JK
51 -re "The target does not support running in non-stop mode" {
52 unsupported "non-stop mode is unsupported"
53 return
c17a9e46 54 }
c17a9e46
HZ
55}
56
5068630a 57gdb_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"
c17a9e46 58
0935723e
JK
59gdb_test "thread 2" {\[Switching to thread 2 .*}
60
5068630a 61gdb_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"
0935723e
JK
62
63gdb_test "thread 3" {\[Switching to thread 3 .*}
c17a9e46 64
0935723e
JK
65set test "continue thread 1"
66gdb_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 '$'.
69 pass $test
c17a9e46 70 }
c17a9e46
HZ
71}
72
0935723e
JK
73set test "thread 3 was signaled"
74gdb_test_multiple "" $test {
5068630a 75 -re "event type: stop\r\nstop reason: signal\r\nstop signal: SIGUSR1\r\nthread num: 3\r\nevent type: stop\r\n" {
0935723e 76 pass $test
c17a9e46 77 }
c17a9e46 78}
This page took 2.208288 seconds and 4 git commands to generate.