This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/testsuite] New 'until' tests


The testsuite part is approved if the corresponding changes to the code itself are.

Thanks Elena.

Regards,
Fernando

Elena Zannoni wrote:> I added files until.c and until.exp that include the only 'until'
tests that the testsuite had (from break.exp) plus a couple of new ones.

OK?
Elena

2002-12-20 Elena Zannoni <ezannoni@redhat.com>

* gdb.base/break.exp: Move the tests of until command from here...
* gdb.base/until.exp: ... to here. New file. Add other tests.
* gdb.base/until.c: New file.


Index: break.exp
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.base/break.exp,v
retrieving revision 1.12
diff -u -p -r1.12 break.exp
--- break.exp 13 May 2002 01:18:19 -0000 1.12
+++ break.exp 20 Dec 2002 18:15:01 -0000
@@ -361,29 +361,6 @@ gdb_expect {
{pass $name}
-re "$gdb_prompt $" {fail $name}
timeout {fail "(timeout) $name"}
-}
-
-# Verify that "until <location>" works. (This is really just syntactic
-# sugar for "tbreak <location>; continue".)
-#
-send_gdb "until 79\n"
-gdb_expect {
- -re "main .* at .*:79.*$gdb_prompt $"\
- {pass "until 79"}
- -re "$gdb_prompt $"\
- {fail "until 79"}
- timeout {fail "(timeout) until 79"}
-}
-
-# Verify that a malformed "until" is gracefully caught.
-#
-send_gdb "until 80 then stop\n"
-gdb_expect {
- -re "Junk at end of arguments..*$gdb_prompt $"\
- {pass "malformed until"}
- -re "$gdb_prompt $"\
- {fail "malformed until"}
- timeout {fail "(timeout) malformed until"}
}
# Verify that GDB responds gracefully when asked to set a breakpoint



--- /dev/null Thu Aug 30 16:30:55 2001
+++ until.c Fri Dec 20 12:47:12 2002
@@ -0,0 +1,45 @@
+
+static int x;
+
+int foo (int a)
+{
+ int b = a + 10;
+ return b;
+}
+
+int bar (int y)
+{
+ int z = y + 20;
+ return z;
+}
+
+void func()
+{
+ x = x + 5;
+ func2 ();
+}
+
+int func2 ()
+{
+ x = 6;
+}
+
+int func3 ()
+{
+ x = 4;
+}
+
+int
+main ()
+{
+ int result;
+ int b, c;
+ c = 5;
+ b = 3; /* until this location */
+ + func (c); /* stop here after leaving current frame */
+ func3 (); /* break here */
+ result = bar (b + foo (c));
+ return 0; /* until malformed */
+}
+


--- /dev/null Thu Aug 30 16:30:55 2001
+++ until.exp Fri Dec 20 12:49:26 2002
@@ -0,0 +1,85 @@
+# Copyright 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# +# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# +# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# until.exp -- Expect script to test 'until' in gdb
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile until
+set srcfile ${srcdir}/${subdir}/${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+remote_exec build "rm -f ${binfile}"
+if { [gdb_compile "${srcfile}" "${binfile}" executable {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return 0
+}
+
+# Verify that "until <location>" works. (This is really just syntactic
+# sugar for "tbreak <location>; continue".)
+#
+gdb_test "until [gdb_get_line_number "until this location"]" \
+ "main .* at .*:.*b = 3.*until this location.*" \
+ "until line number"
+
+# Verify that a malformed "until" is gracefully caught.
+#
+gdb_test "until [gdb_get_line_number "until malformed"] then stop" \
+ "Junk at end of arguments." "malformed until"
+
+# Verify that "until <funcname>" works.
+#
+gdb_test "until func" \
+ "func.*at.*x = x \\+ 5." \
+ "until func"
+
+# Verify that "until <funcname>" when funcname is NOT called by the current
+# frame, stops at the end of the current frame.
+#
+gdb_test "until func3" \
+ "in main.*func \\(c\\).*stop here after leaving current frame..."\
+ "until function not called by current frame"
+
+# break at main again
+#
+gdb_test "break [gdb_get_line_number "break here"]" \
+ ".*Breakpoint.* at .*" \
+ "set breakpoint at call to func3"
+gdb_test "continue" \
+ ".*Breakpoint ${decimal}, main.*func3.*break here.*" \
+ "continue to call to func3 in main"
+
+# Verify that "until <funcname>" when funcname is called as parameter to +# another function works.
+#
+gdb_test "until foo" \
+ "foo \\(a=5\\).*int b = a \\+ 10;"\
+ "until function called as param"
+



--
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]