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/>.
20 load_lib gdb-python.exp
22 set libfile "py-events-shlib"
23 set libsrc $srcdir/$subdir/$libfile.c
24 set lib_sl $objdir/$subdir/$libfile.so
27 set testfile "py-events"
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
30 set exec_opts [list debug shlib=$lib_sl]
31 set pyfile ${srcdir}/${subdir}/${testfile}.py
33 if [get_compiler_info ${binfile}] {
37 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
38 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
39 untested "Could not compile either $libsrc or $srcdir/$subdir/$srcfile."
43 # Start with a fresh gdb.
44 clean_restart ${testfile}
46 if { [skip_python_tests] } { continue }
48 gdb_test_no_output "python execfile ('${pyfile}')" ""
50 gdb_test "Test_Newobj_Events" "New ObjectFile Event tester registered." "Register new objfile event handler"
52 gdb_breakpoint "main" {temporary}
54 gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "New objfile notification"
56 gdb_test_no_output "set detach-on-fork off" ""
58 gdb_test "Test_Events" "Event testers registered."
60 gdb_breakpoint "first"
61 gdb_breakpoint "first"
63 # Test continue event and breakpoint stop event
64 gdb_test "continue" ".*event type: continue.*
66 .*stop reason: breakpoint.*
67 .*first breakpoint number: 2.*
68 .*breakpoint number: 2.*
69 .*breakpoint number: 3.*
73 gdb_test "continue" ".*event type: continue.*
76 .*exit inf: 1.*" "Inferior 1 terminated."
78 gdb_test "inferior 2" ".*Switching to inferior 2.*"
79 gdb_test "continue" ".*event type: continue.*
82 .*exit inf: 2.*" "Inferior 2 terminated."