2012-01-05 Pedro Alves <alves.ped@gmail.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-events.exp
CommitLineData
c5a57081 1# Copyright (C) 2010-2012 Free Software Foundation, Inc.
c17a9e46
HZ
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
3a3dad98
JK
16if [target_info exists use_gdb_stub] {
17 return 0
18}
19
c17a9e46
HZ
20if $tracelevel then {
21 strace $tracelevel
22}
23
24load_lib gdb-python.exp
25
20c168b5
KP
26set libfile "py-events-shlib"
27set libsrc $srcdir/$subdir/$libfile.c
28set lib_sl $objdir/$subdir/$libfile.so
29set lib_opts debug
30
c17a9e46
HZ
31set testfile "py-events"
32set srcfile ${testfile}.c
33set binfile ${objdir}/${subdir}/${testfile}
20c168b5 34set exec_opts [list debug shlib=$lib_sl]
c17a9e46
HZ
35set pyfile ${srcdir}/${subdir}/${testfile}.py
36
20c168b5 37if [get_compiler_info ${binfile}] {
c17a9e46
HZ
38 return -1
39}
40
20c168b5
KP
41if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
42 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
43 untested "Could not compile either $libsrc or $srcdir/$subdir/$srcfile."
44 return -1
45}
46
47# Start with a fresh gdb.
48clean_restart ${testfile}
49
c17a9e46
HZ
50if { [skip_python_tests] } { continue }
51
52gdb_test_no_output "python execfile ('${pyfile}')" ""
53
20c168b5
KP
54gdb_test "Test_Newobj_Events" "New ObjectFile Event tester registered." "Register new objfile event handler"
55
56gdb_breakpoint "main" {temporary}
57
58gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "New objfile notification"
c17a9e46 59
cb6be26b
KP
60gdb_test_no_output "set detach-on-fork off" ""
61
c17a9e46
HZ
62gdb_test "Test_Events" "Event testers registered."
63
6839b47f 64gdb_breakpoint "first"
c17a9e46
HZ
65gdb_breakpoint "first"
66
67# Test continue event and breakpoint stop event
68gdb_test "continue" ".*event type: continue.*
69.*event type: stop.*
70.*stop reason: breakpoint.*
6839b47f 71.*first breakpoint number: 2.*
c17a9e46 72.*breakpoint number: 2.*
6839b47f 73.*breakpoint number: 3.*
c17a9e46
HZ
74all threads stopped"
75
76#test exited event.
77gdb_test "continue" ".*event type: continue.*
78.*event type: exit.*
cb6be26b
KP
79.*exit code: 12.*
80.*exit inf: 1.*" "Inferior 1 terminated."
81
82gdb_test "inferior 2" ".*Switching to inferior 2.*"
83gdb_test "continue" ".*event type: continue.*
84.*event type: exit.*
85.*exit code: 12.*
86.*exit inf: 2.*" "Inferior 2 terminated."
This page took 0.137673 seconds and 4 git commands to generate.