Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / until.exp
CommitLineData
88b9d363 1# Copyright 2003-2022 Free Software Foundation, Inc.
82025e13
EZ
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
82025e13 6# (at your option) any later version.
e22f8b7c 7#
82025e13
EZ
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.
e22f8b7c 12#
82025e13 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>. */
82025e13 15
82025e13
EZ
16# until.exp -- Expect script to test 'until' in gdb
17
aa81e255 18set srcfile break.c
5b362f04 19if { [prepare_for_testing "failed to prepare" "until" {break.c break1.c} {debug nowarnings}] } {
aa81e255 20 return -1
a1dea79a
FF
21}
22
a1dea79a
FF
23set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
24set bp_location19 [gdb_get_line_number "set breakpoint 19 here"]
25set bp_location20 [gdb_get_line_number "set breakpoint 20 here"]
26set bp_location21 [gdb_get_line_number "set breakpoint 21 here"]
27
82025e13 28if ![runto_main] then {
bc6c7af4 29 fail "can't run to main"
82025e13
EZ
30 return 0
31}
32
33# Verify that "until <location>" works. (This is really just syntactic
34# sugar for "tbreak <location>; continue".)
35#
a1dea79a
FF
36gdb_test "until $bp_location1" \
37 "main .* at .*:$bp_location1.*" \
82025e13
EZ
38 "until line number"
39
40# Verify that a malformed "advance" is gracefully caught.
41#
42gdb_test "until 80 then stop" \
40e084e1
KS
43 "malformed linespec error: unexpected string, \"then stop\"." \
44 "malformed until"
82025e13
EZ
45
46# Rerun up to factorial, outer invocation
0ac85db5
SM
47if { ![runto factorial] } {
48 return
49}
50
82025e13
EZ
51delete_breakpoints
52
53# At this point, 'until' should continue the inferior up to when all the
54# inner invocations of factorial() are completed and we are back at this
55# frame.
56#
a1dea79a
FF
57gdb_test "until $bp_location19" \
58 "factorial.*value=720.*at.*${srcfile}:$bp_location19.*return \\(value\\).*" \
82025e13
EZ
59 "until factorial, recursive function"
60
61# Run to a function called by main
62#
0ac85db5
SM
63if { ![runto marker2] } {
64 return
65}
66
82025e13
EZ
67delete_breakpoints
68
69# Now issue an until with another function, not called by the current
70# frame, as argument. This should not work, i.e. the program should
71# stop at main, the caller, where we put the 'guard' breakpoint.
72#
73gdb_test "until marker3" \
a1dea79a 74 "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:($bp_location20.*marker2 \\(43\\)|$bp_location21.*marker3 \\(.stack., .trace.\\)).*" \
82025e13
EZ
75 "until func, not called by current frame"
76
This page took 2.401517 seconds and 4 git commands to generate.