* config/pa/tm-hppa.h: Define lots register offsets needed by
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / recurse.exp
CommitLineData
ef44eed1
SS
1# Copyright (C) 1992 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 2 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, write to the Free Software
15# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20# This file was written by Jeff Law. (law@cs.utah.edu)
21
22if $tracelevel then {
23 strace $tracelevel
24}
25
26set prms_id 0
27set bug_id 0
28
29set binfile "recurse"
30set srcfile $binfile.c
31
32if ![file exists $objdir/$subdir/$binfile] then {
33 perror "$objdir/$subdir/$binfile does not exist."
34 return 0
35}
36
37
38# Start with a fresh gdb.
39
40gdb_exit
41gdb_start
42gdb_reinitialize_dir $srcdir/$subdir
43gdb_load $objdir/$subdir/$binfile
44
45# For now we only run this on PAs running BSD.
31a425c3 46if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"]} then {
ef44eed1
SS
47
48 # Preserve the old timeout, and set a new one that should be
49 # sufficient to avoid timing out during this test.
50
51 set timeoutsave $timeout
52 set timeout 60
53
54 if [runto recurse] then {
55 gdb_test "watch b" ".*\[Ww\]atchpoint \[0-9]*: b"
56
57 # Continue until initial set of b.
58 send "cont\n"
59 expect {
eead772b 60 -re "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 0.*New value = 10.*$prompt $" { pass "watchpoint hit, first time" }
ef44eed1
SS
61 -re ".*$prompt $" { fail "missed first watchpoint" ; return }
62 timeout { fail "missed first watchpoint (timeout)" ; return }
63 }
64
65 # Continue inward for a few iterations
eead772b
JL
66 gdb_test "continue" "Breakpoint.* recurse \\(+a=9\\).*"
67 gdb_test "continue" "Breakpoint.* recurse \\(+a=8\\).*"
68 gdb_test "continue" "Breakpoint.* recurse \\(+a=7\\).*"
69 gdb_test "continue" "Breakpoint.* recurse \\(+a=6\\).*"
70 gdb_test "continue" "Breakpoint.* recurse \\(+a=5\\).*"
ef44eed1
SS
71
72 # Put a watchpoint on another instance of b
73 gdb_test "watch b" ".*\[Ww\]atchpoint \[0-9]*: b"
74
75 # Continue until initial set of b (second instance).
76 send "cont\n"
77 expect {
eead772b 78 -re "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 0.*New value = 5.*$prompt $" { pass "watchpoint hit (second instance)" }
ef44eed1
SS
79 -re ".*$prompt $" {
80 fail "missed watchpoint (second instance)"
81 return
82 }
83 timeout {
84 fail "missed watchpoint (second instance) (timeout)"
85 return
86 }
87 }
88
89 # Continue inward for a few iterations
eead772b
JL
90 gdb_test "continue" "Breakpoint.* recurse \\(+a=4\\).*"
91 gdb_test "continue" "Breakpoint.* recurse \\(+a=3\\).*"
92 gdb_test "continue" "Breakpoint.* recurse \\(+a=2\\).*"
93 gdb_test "continue" "Breakpoint.* recurse \\(+a=1\\).*"
ef44eed1
SS
94
95 # Continue until second set of b (second instance).
96 send "cont\n"
31a425c3 97 setup_xfail "sparc*-*-sunos4*"
ef44eed1 98 expect {
eead772b 99 -re "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 5.*New value = 120.*return.*$prompt $" { pass "watchpoint hit, second time (second instance)" }
ef44eed1
SS
100 -re ".*$prompt $" {
101 fail "missed watchpoint, second time (second instance)"
102 return
103 }
104 timeout {
105 fail "missed watchpoint, second time (second instance)(timeout)"
106 return
107 }
108 }
109
110 # Continue again. We should have a watchpoint go out of scope now
111 send "cont\n"
112 expect {
eead772b 113 -re "Continuing.*\[Ww\]atchpoint.*deleted.*recurse \[(\]+a=6\[)\]+ .*$prompt $" {pass "watchpoint deleted when leaving scope (second instance)" }
ef44eed1
SS
114 -re ".*prompt $" {
115 fail "watchpoint not deleted when leaving scope (second instance)"
116 return
117 }
118 timeout {
119 fail "watchpoint not deleted when leaving scope (second instance) (timeout)"
120 return
121 }
122 }
123
124 # Continue until second set of b (first instance).
125 send "cont\n"
126 expect {
eead772b 127 -re "Continuing.*\[Ww\]atchpoint.*b.*Old value = 10.*New value = 3628800.*return.*$prompt $" { pass "watchpoint hit, second time" }
ef44eed1
SS
128 -re ".*$prompt $" {
129 fail "missed watchpoint, second time)"
130 return
131 }
132 timeout {
133 fail "missed watchpoint, second time (timeout)"
134 return
135 }
136 }
137
138 # Continue again. We should have a watchpoint go out of scope now
139 send "cont\n"
140 expect {
eead772b 141 -re "Continuing.*\[Ww\]atchpoint.*deleted.*main \[(\]+\[)\]+ .*$prompt $" {pass "watchpoint deleted when leaving scope" }
ef44eed1
SS
142 -re ".*prompt $" {
143 fail "watchpoint not deleted when leaving scope"
144 return
145 }
146 timeout {
147 fail "watchpoint not deleted when leaving scope (timeout)"
148 return
149 }
150 }
151 }
152
153 # Restore the preserved old timeout value.
154 set timeout $timeoutsave
155}
This page took 0.092161 seconds and 4 git commands to generate.