Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright (C) 2010-2016 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 | ||
0935723e JK |
16 | if {[is_remote target]} { |
17 | # RuntimeError: Could not find event thread | |
18 | kfail "python/12966" "Run to breakpoint 1" | |
19 | return -1 | |
20 | } | |
21 | ||
d5b4a7be YQ |
22 | if { ![support_displaced_stepping] } { |
23 | unsupported "displaced stepping" | |
24 | return -1 | |
25 | } | |
26 | ||
c17a9e46 HZ |
27 | load_lib gdb-python.exp |
28 | ||
b4a58790 | 29 | standard_testfile |
c17a9e46 HZ |
30 | set pyfile ${srcdir}/${subdir}/py-events.py |
31 | ||
0935723e JK |
32 | if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
33 | return -1 | |
34 | } | |
c17a9e46 HZ |
35 | clean_restart $testfile |
36 | ||
37 | if { [skip_python_tests] } { continue } | |
38 | ||
9325cb04 | 39 | gdb_test_no_output "python exec (open ('${pyfile}').read ())" "" |
c17a9e46 | 40 | |
314bb8c3 | 41 | gdb_test "test-events" "Event testers registered." |
c17a9e46 | 42 | gdb_test_no_output "set non-stop on" |
c17a9e46 HZ |
43 | |
44 | gdb_breakpoint "main" | |
45 | gdb_breakpoint "thread2" | |
46 | gdb_breakpoint "thread3" | |
47 | ||
0935723e | 48 | gdb_run_cmd |
bc6c7af4 | 49 | set test "run to breakpoint 1" |
0935723e | 50 | gdb_test_multiple "" $test { |
5068630a | 51 | -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 | 52 | pass $test |
c17a9e46 | 53 | } |
0935723e JK |
54 | -re "The target does not support running in non-stop mode" { |
55 | unsupported "non-stop mode is unsupported" | |
56 | return | |
c17a9e46 | 57 | } |
c17a9e46 HZ |
58 | } |
59 | ||
5068630a | 60 | 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" |
c17a9e46 | 61 | |
0935723e JK |
62 | gdb_test "thread 2" {\[Switching to thread 2 .*} |
63 | ||
5068630a | 64 | 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" |
0935723e JK |
65 | |
66 | gdb_test "thread 3" {\[Switching to thread 3 .*} | |
c17a9e46 | 67 | |
0935723e JK |
68 | set test "continue thread 1" |
69 | gdb_test_multiple "continue&" $test { | |
70 | -re "event type: continue\r\nthread num: 3\r\n$gdb_prompt " { | |
71 | # This expect string must not expect the end-of-buffer '$'. | |
72 | pass $test | |
c17a9e46 | 73 | } |
c17a9e46 HZ |
74 | } |
75 | ||
0935723e JK |
76 | set test "thread 3 was signaled" |
77 | gdb_test_multiple "" $test { | |
5068630a | 78 | -re "event type: stop\r\nstop reason: signal\r\nstop signal: SIGUSR1\r\nthread num: 3\r\nevent type: stop\r\n" { |
0935723e | 79 | pass $test |
c17a9e46 | 80 | } |
c17a9e46 | 81 | } |