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 if { ![support_displaced_stepping] } {
26 unsupported "displaced stepping"
30 load_lib gdb-python.exp
32 set testfile "py-evthreads"
33 set srcfile ${testfile}.c
34 set binfile ${objdir}/${subdir}/${testfile}
35 set pyfile ${srcdir}/${subdir}/py-events.py
37 gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}
38 clean_restart $testfile
40 if { [skip_python_tests] } { continue }
42 gdb_test_no_output "python execfile ('${pyfile}')" ""
44 gdb_test "Test_Events" "Event testers registered."
45 gdb_test_no_output "set non-stop on"
46 gdb_test_no_output "set target-async on"
49 gdb_breakpoint "thread2"
50 gdb_breakpoint "thread3"
54 -re "event type: stop.*
55 .*stop reason: breakpoint.*
56 .*breakpoint number: 1.*
58 pass "reached breakpoint 1"
61 fail "did not reach breakpoint 1"
67 -re "event type: stop.*
68 .*stop reason: breakpoint.*
69 .*breakpoint number: 2.*
71 pass "reached breakpoint 2"
74 fail "did not reach breakpoint 2"
80 -re "event type: stop.*
81 .*stop reason: breakpoint.*
82 .*breakpoint number: 3.*
84 pass "reached breakpoint 3"
87 fail "did not reach breakpoint 3"
91 send_gdb "continue&\n"
93 -re ".*event type: continue.*
94 .*thread num: 1.*\r\n$gdb_prompt $" {
95 pass "continue thread 1"
98 fail "continue thread 1 failed"
102 gdb_test "thread 2" ".*Switching to thread 2.*"
103 send_gdb "continue&\n"
105 -re ".*event type: continue.*
107 pass "continue thread 2"
110 fail "continue thread 2 failed"
114 send_gdb "continue -a\n"
116 -re ".*stop reason: signal.*
117 .*stop signal: SIGSEGV.*
119 pass "thread 3 was signalled"
122 fail "thread 3 was not signalled"