]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.python/py-events.exp
2011-10-04 Kevin Pouget <kevin.pouget@st.com>
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-events.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 if $tracelevel then {
17 strace $tracelevel
18 }
19
20 load_lib gdb-python.exp
21
22 set testfile "py-events"
23 set srcfile ${testfile}.c
24 set binfile ${objdir}/${subdir}/${testfile}
25 set pyfile ${srcdir}/${subdir}/${testfile}.py
26
27 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
28 return -1
29 }
30
31 if { [skip_python_tests] } { continue }
32
33 gdb_test_no_output "python execfile ('${pyfile}')" ""
34
35 if ![runto_main ] then {
36 fail "Can't run to main"
37 return -1
38 }
39
40 gdb_test_no_output "set detach-on-fork off" ""
41
42 gdb_test "Test_Events" "Event testers registered."
43
44 gdb_breakpoint "first"
45 gdb_breakpoint "first"
46
47 # Test continue event and breakpoint stop event
48 gdb_test "continue" ".*event type: continue.*
49 .*event type: stop.*
50 .*stop reason: breakpoint.*
51 .*first breakpoint number: 2.*
52 .*breakpoint number: 2.*
53 .*breakpoint number: 3.*
54 all threads stopped"
55
56 #test exited event.
57 gdb_test "continue" ".*event type: continue.*
58 .*event type: exit.*
59 .*exit code: 12.*
60 .*exit inf: 1.*" "Inferior 1 terminated."
61
62 gdb_test "inferior 2" ".*Switching to inferior 2.*"
63 gdb_test "continue" ".*event type: continue.*
64 .*event type: exit.*
65 .*exit code: 12.*
66 .*exit inf: 2.*" "Inferior 2 terminated."