1 # Copyright (C) 2010-2012 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 if [target_info exists use_gdb_stub] {
24 load_lib gdb-python.exp
26 set libfile "py-events-shlib"
27 set libsrc $srcdir/$subdir/$libfile.c
28 set lib_sl $objdir/$subdir/$libfile.so
31 set testfile "py-events"
32 set srcfile ${testfile}.c
33 set binfile ${objdir}/${subdir}/${testfile}
34 set exec_opts [list debug shlib=$lib_sl]
35 set pyfile ${srcdir}/${subdir}/${testfile}.py
37 if [get_compiler_info ${binfile}] {
41 if { [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."
47 # Start with a fresh gdb.
48 clean_restart ${testfile}
50 if { [skip_python_tests] } { continue }
52 gdb_test_no_output "python execfile ('${pyfile}')" ""
54 gdb_test "Test_Newobj_Events" "New ObjectFile Event tester registered." "Register new objfile event handler"
56 gdb_breakpoint "main" {temporary}
58 gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "New objfile notification"
60 gdb_test_no_output "set detach-on-fork off" ""
62 gdb_test "Test_Events" "Event testers registered."
64 gdb_breakpoint "first"
65 gdb_breakpoint "first"
67 # Test continue event and breakpoint stop event
68 gdb_test "continue" ".*event type: continue.*
70 .*stop reason: breakpoint.*
71 .*first breakpoint number: 2.*
72 .*breakpoint number: 2.*
73 .*breakpoint number: 3.*
77 gdb_test "continue" ".*event type: continue.*
80 .*exit inf: 1.*" "Inferior 1 terminated."
82 gdb_test "inferior 2" ".*Switching to inferior 2.*"
83 gdb_test "continue" ".*event type: continue.*
86 .*exit inf: 2.*" "Inferior 2 terminated."