OSDN Git Service

Copyright year update in most files of the GDB Project.
[pf3gnuchains/pf3gnuchains4x.git] / gdb / testsuite / gdb.python / py-events.exp
1 # Copyright (C) 2010-2012 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 [target_info exists use_gdb_stub] {
17     return 0
18 }
19
20 if $tracelevel then {
21     strace $tracelevel
22 }
23
24 load_lib gdb-python.exp
25
26 set libfile "py-events-shlib"
27 set libsrc  $srcdir/$subdir/$libfile.c
28 set lib_sl  $objdir/$subdir/$libfile.so
29 set lib_opts  debug
30
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
36
37 if [get_compiler_info ${binfile}] {
38     return -1
39 }
40
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."
44     return -1
45 }
46
47 # Start with a fresh gdb.
48 clean_restart ${testfile}
49
50 if { [skip_python_tests] } { continue }
51
52 gdb_test_no_output "python execfile ('${pyfile}')" ""
53
54 gdb_test "Test_Newobj_Events" "New ObjectFile Event tester registered." "Register new objfile event handler"
55
56 gdb_breakpoint "main" {temporary}
57
58 gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "New objfile notification"
59
60 gdb_test_no_output "set detach-on-fork off" ""
61
62 gdb_test "Test_Events" "Event testers registered."
63
64 gdb_breakpoint "first"
65 gdb_breakpoint "first"
66
67 # Test continue event and breakpoint stop event
68 gdb_test "continue" ".*event type: continue.*
69 .*event type: stop.*
70 .*stop reason: breakpoint.*
71 .*first breakpoint number: 2.*
72 .*breakpoint number: 2.*
73 .*breakpoint number: 3.*
74 all threads stopped"
75
76 #test exited event.
77 gdb_test "continue" ".*event type: continue.*
78 .*event type: exit.*
79 .*exit code: 12.*
80 .*exit inf: 1.*" "Inferior 1 terminated."
81
82 gdb_test "inferior 2" ".*Switching to inferior 2.*"
83 gdb_test "continue" ".*event type: continue.*
84 .*event type: exit.*
85 .*exit code: 12.*
86 .*exit inf: 2.*" "Inferior 2 terminated."