revert previous patch so that I can re-commit with correct author
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-events.exp
CommitLineData
ecd75fc8 1# Copyright (C) 2010-2014 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
20load_lib gdb-python.exp
21
20c168b5
KP
22set libfile "py-events-shlib"
23set libsrc $srcdir/$subdir/$libfile.c
b4a58790 24set lib_sl [standard_output_file $libfile.so]
20c168b5
KP
25set lib_opts debug
26
b4a58790 27standard_testfile
20c168b5 28set exec_opts [list debug shlib=$lib_sl]
c17a9e46
HZ
29set pyfile ${srcdir}/${subdir}/${testfile}.py
30
4c93b1db 31if [get_compiler_info] {
c17a9e46
HZ
32 return -1
33}
34
20c168b5
KP
35if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
36 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
37 untested "Could not compile either $libsrc or $srcdir/$subdir/$srcfile."
38 return -1
39}
40
41# Start with a fresh gdb.
42clean_restart ${testfile}
43
c17a9e46
HZ
44if { [skip_python_tests] } { continue }
45
9325cb04 46gdb_test_no_output "python exec (open ('${pyfile}').read ())" ""
c17a9e46 47
314bb8c3 48gdb_test "test-objfile-events" "Object file events registered."
20c168b5
KP
49
50gdb_breakpoint "main" {temporary}
51
52gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "New objfile notification"
c17a9e46 53
cb6be26b
KP
54gdb_test_no_output "set detach-on-fork off" ""
55
314bb8c3 56gdb_test "test-events" "Event testers registered."
c17a9e46 57
6839b47f 58gdb_breakpoint "first"
c17a9e46
HZ
59gdb_breakpoint "first"
60
61# Test continue event and breakpoint stop event
62gdb_test "continue" ".*event type: continue.*
63.*event type: stop.*
64.*stop reason: breakpoint.*
6839b47f 65.*first breakpoint number: 2.*
c17a9e46 66.*breakpoint number: 2.*
6839b47f 67.*breakpoint number: 3.*
c17a9e46
HZ
68all threads stopped"
69
2ca0b532
PA
70# Test that when "step N" trips on a breakpoint, we get a stop event
71# with breakpoint stop reason.
72gdb_breakpoint "do_nothing"
73gdb_test "step 3" ".*event type: continue.*
74.*event type: stop.*
75.*stop reason: breakpoint.*
76.*first breakpoint number: 4.*
77.*breakpoint number: 4.*
78all threads stopped"
79
80delete_breakpoints
81
c17a9e46
HZ
82#test exited event.
83gdb_test "continue" ".*event type: continue.*
4ffbba72 84.*clear_objfiles\[\r\n\]*progspace: .*py-events.*
c17a9e46 85.*event type: exit.*
cb6be26b 86.*exit code: 12.*
2e8265fd
TT
87.*exit inf: 1.*
88dir ok: True.*" "Inferior 1 terminated."
cb6be26b
KP
89
90gdb_test "inferior 2" ".*Switching to inferior 2.*"
91gdb_test "continue" ".*event type: continue.*
92.*event type: exit.*
93.*exit code: 12.*
2e8265fd
TT
94.*exit inf: 2.*
95dir ok: True.*" "Inferior 2 terminated."
This page took 0.505633 seconds and 4 git commands to generate.