]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/until.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / until.exp
CommitLineData
6aba47ca 1# Copyright 2003, 2007 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
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20# until.exp -- Expect script to test 'until' in gdb
21
22if $tracelevel then {
23 strace $tracelevel
24}
25
a1dea79a 26set testfile "break"
f2dd3617 27set srcfile ${testfile}.c
a1dea79a 28set srcfile1 ${testfile}1.c
82025e13
EZ
29set binfile ${objdir}/${subdir}/${testfile}
30
fc91c6c2 31if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
b60f0898
JB
32 untested until.exp
33 return -1
a1dea79a
FF
34}
35
fc91c6c2 36if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
b60f0898
JB
37 untested until.exp
38 return -1
a1dea79a
FF
39}
40
fc91c6c2 41if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
b60f0898
JB
42 untested until.exp
43 return -1
82025e13
EZ
44}
45
46gdb_exit
47gdb_start
48gdb_reinitialize_dir $srcdir/$subdir
49gdb_load ${binfile}
50
a1dea79a
FF
51set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
52set bp_location19 [gdb_get_line_number "set breakpoint 19 here"]
53set bp_location20 [gdb_get_line_number "set breakpoint 20 here"]
54set bp_location21 [gdb_get_line_number "set breakpoint 21 here"]
55
82025e13
EZ
56if ![runto_main] then {
57 fail "Can't run to main"
58 return 0
59}
60
61# Verify that "until <location>" works. (This is really just syntactic
62# sugar for "tbreak <location>; continue".)
63#
a1dea79a
FF
64gdb_test "until $bp_location1" \
65 "main .* at .*:$bp_location1.*" \
82025e13
EZ
66 "until line number"
67
68# Verify that a malformed "advance" is gracefully caught.
69#
70gdb_test "until 80 then stop" \
71 "Junk at end of arguments." "malformed until"
72
73# Rerun up to factorial, outer invocation
74if { ![runto factorial] } then { gdb_suppress_tests; }
75delete_breakpoints
76
77# At this point, 'until' should continue the inferior up to when all the
78# inner invocations of factorial() are completed and we are back at this
79# frame.
80#
a1dea79a
FF
81gdb_test "until $bp_location19" \
82 "factorial.*value=720.*at.*${srcfile}:$bp_location19.*return \\(value\\).*" \
82025e13
EZ
83 "until factorial, recursive function"
84
85# Run to a function called by main
86#
87if { ![runto marker2] } then { gdb_suppress_tests; }
88delete_breakpoints
89
90# Now issue an until with another function, not called by the current
91# frame, as argument. This should not work, i.e. the program should
92# stop at main, the caller, where we put the 'guard' breakpoint.
93#
94gdb_test "until marker3" \
a1dea79a 95 "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:($bp_location20.*marker2 \\(43\\)|$bp_location21.*marker3 \\(.stack., .trace.\\)).*" \
82025e13
EZ
96 "until func, not called by current frame"
97