gdb.python/py-evthreads.exp: add missing $
[platform/upstream/binutils.git] / gdb / testsuite / gdb.python / py-evthreads.exp
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
16 # This file is part of the GDB testsuite.  It tests Python-based
17 # pretty-printing for the CLI.
18
19 # Skip all tests if Python scripting is not enabled.
20
21 if $tracelevel then {
22     strace $tracelevel
23 }
24
25 load_lib gdb-python.exp
26
27 set testfile "py-evthreads"
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
30 set pyfile ${srcdir}/${subdir}/py-events.py
31
32 gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}
33 clean_restart $testfile
34
35 if { [skip_python_tests] } { continue }
36
37 gdb_test_no_output "python execfile ('${pyfile}')" ""
38
39 gdb_test "Test_Events" "Event testers registered."
40 gdb_test_no_output "set non-stop on"
41 gdb_test_no_output "set target-async on"
42
43 gdb_breakpoint "main"
44 gdb_breakpoint "thread2"
45 gdb_breakpoint "thread3"
46
47 send_gdb "run\n"
48 gdb_expect {
49     -re "event type: stop.*
50 .*stop reason: breakpoint.*
51 .*breakpoint number: 1.*
52 .*thread num: 1.*" {
53         pass "reached breakpoint 1"
54     }
55     timeout {
56             fail "did not reach breakpoint 1"
57         }
58 }
59
60 send_gdb "next\n"
61 gdb_expect {
62     -re "event type: stop.*
63 .*stop reason: breakpoint.*
64 .*breakpoint number: 2.*
65 .*thread num: 2.*" {
66         pass "reached breakpoint 2"
67     }
68     timeout {
69             fail "did not reach breakpoint 2"
70         }
71 }
72
73 send_gdb "next\n"
74 gdb_expect {
75     -re "event type: stop.*
76 .*stop reason: breakpoint.*
77 .*breakpoint number: 3.*
78 .*thread num: 3.*" {
79         pass "reached breakpoint 3"
80     }
81     timeout {
82             fail "did not reach breakpoint 3"
83         }
84 }
85
86 send_gdb "continue&\n"
87 gdb_expect {
88     -re ".*event type: continue.*
89 .*thread num: 1.*\r\n$gdb_prompt $" {
90         pass "continue thread 1"
91     }
92     timeout {
93             fail "continue thread 1 failed"
94         }
95 }
96
97 gdb_test "thread 2" ".*Switching to thread 2.*"
98 send_gdb "continue&\n"
99 gdb_expect {
100     -re ".*event type: continue.*
101 .*thread num: 2.*" {
102         pass "continue thread 2"
103     }
104     timeout {
105             fail "continue thread 2 failed"
106         }
107 }
108
109 send_gdb "continue -a\n"
110 gdb_expect {
111     -re ".*stop reason: signal.*
112 .*stop signal: SIGSEGV.*
113 .*thread num: 3.*" {
114         pass "thread 3 was signalled"
115     }
116     timeout {
117             fail "thread 3 was not signalled"
118         }
119 }