1 # Copyright (C) 2010, 2011 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 # This file is part of the GDB testsuite. It tests Python-based
17 # pretty-printing for the CLI.
19 # Skip all tests if Python scripting is not enabled.
25 load_lib gdb-python.exp
27 set testfile "py-evthreads"
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
30 set pyfile ${srcdir}/${subdir}/py-events.py
32 gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}
33 clean_restart $testfile
35 if { [skip_python_tests] } { continue }
37 gdb_test_no_output "python execfile ('${pyfile}')" ""
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"
44 gdb_breakpoint "thread2"
45 gdb_breakpoint "thread3"
49 -re "event type: stop.*
50 .*stop reason: breakpoint.*
51 .*breakpoint number: 1.*
53 pass "reached breakpoint 1"
56 fail "did not reach breakpoint 1"
62 -re "event type: stop.*
63 .*stop reason: breakpoint.*
64 .*breakpoint number: 2.*
66 pass "reached breakpoint 2"
69 fail "did not reach breakpoint 2"
75 -re "event type: stop.*
76 .*stop reason: breakpoint.*
77 .*breakpoint number: 3.*
79 pass "reached breakpoint 3"
82 fail "did not reach breakpoint 3"
86 send_gdb "continue&\n"
88 -re ".*event type: continue.*
89 .*thread num: 1.*\r\n$gdb_prompt $" {
90 pass "continue thread 1"
93 fail "continue thread 1 failed"
97 gdb_test "thread 2" ".*Switching to thread 2.*"
98 send_gdb "continue&\n"
100 -re ".*event type: continue.*
102 pass "continue thread 2"
105 fail "continue thread 2 failed"
109 send_gdb "continue -a\n"
111 -re ".*stop reason: signal.*
112 .*stop signal: SIGSEGV.*
114 pass "thread 3 was signalled"
117 fail "thread 3 was not signalled"