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