]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/until.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / until.exp
1 # Copyright 2003-2024 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 # until.exp -- Expect script to test 'until' in gdb
17
18 set srcfile break.c
19 if { [prepare_for_testing "failed to prepare" "until" {break.c break1.c} {debug nowarnings}] } {
20 return -1
21 }
22
23 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
24 set bp_location19 [gdb_get_line_number "set breakpoint 19 here"]
25 set bp_location20 [gdb_get_line_number "set breakpoint 20 here"]
26 set bp_location21 [gdb_get_line_number "set breakpoint 21 here"]
27
28 if {![runto_main]} {
29 return 0
30 }
31
32 # Verify that "until <location>" works. (This is really just syntactic
33 # sugar for "tbreak <location>; continue".)
34 #
35 gdb_test "until $bp_location1" \
36 "main .* at .*:$bp_location1.*" \
37 "until line number"
38
39 # Verify that a malformed "advance" is gracefully caught.
40 #
41 gdb_test "until 80 then stop" \
42 "malformed linespec error: unexpected string, \"then stop\"" \
43 "malformed until"
44
45 # Rerun up to factorial, outer invocation
46 if { ![runto factorial] } {
47 return
48 }
49
50 delete_breakpoints
51
52 # At this point, 'until' should continue the inferior up to when all the
53 # inner invocations of factorial() are completed and we are back at this
54 # frame.
55 #
56 gdb_test "until $bp_location19" \
57 "factorial.*value=720.*at.*${srcfile}:$bp_location19.*return \\(value\\).*" \
58 "until factorial, recursive function"
59
60 # Run to a function called by main
61 #
62 if { ![runto marker2] } {
63 return
64 }
65
66 delete_breakpoints
67
68 # Now issue an until with another function, not called by the current
69 # frame, as argument. This should not work, i.e. the program should
70 # stop at main, the caller, where we put the 'guard' breakpoint.
71 #
72 gdb_test "until marker3" \
73 "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:($bp_location20.*marker2 \\(43\\)|$bp_location21.*marker3 \\(.stack., .trace.\\)).*" \
74 "until func, not called by current frame"
75