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]

[rfa/testsuite] advance.exp, until.exp: accommodate different return lines


This patch fixes a bug in gdb.base/advance.exp and gdb.base/until.exp.
I analyzed this bug here:

  http://sources.redhat.com/ml/gdb-patches/2003-01/msg00621.html

Briefly:

  the program under test calls 'func(c);'.
  the user types in the 'advance' command
  gdb runs to the return breakpoint in the calling frame

The source line of the return breakpoint might be on the same line as
'func(c)', or it might be on the next line.  This depends on whether
the machine code has any instructions after the 'CALL' instruction,
such as stack cleanup instructions.  This is ABI and platform dependent.

So I enhanced the tests to recognize both responses from gdb.

Testing: my usual testbed: native i686-pc-linux-gnu; gcc 2.95.3 and gcc
3.2.1 (and some more gcc's); dwarf-2 and stabs+.  This fixes 5 FAIL's in
all the gcc 3.X configurations.  All tests now PASS in both advance.exp
and until.exp.

Elena Z wrote these tests, so I am hoping that she can approve
this patch (or recommend it to Fernando N for approval).

OK to apply?

Michael C

2003-02-01  Michael Chastain  <mec@shout.net>

	* gdb.base/advance.c (marker1): New marker function.
	* gdb.base/advance.exp: When the 'advance' command lands on the
	return breakpoint, it can legitimately stop on either the
	current line or the next line.  Accommodate both outcomes.
	* gdb.base/until.exp: Likewise.

Index: advance.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/advance.c,v
retrieving revision 1.1
diff -u -r1.1 advance.c
--- advance.c	15 Jan 2003 14:25:11 -0000	1.1
+++ advance.c	3 Feb 2003 05:41:42 -0000
@@ -29,6 +29,10 @@
   x = 4;
 }
 
+void marker1 ()
+{
+}
+
 int
 main ()
 {
@@ -38,6 +42,7 @@
   b = 3;    /* advance this location */
     
   func (c); /* stop here after leaving current frame */
+  marker1 (); /* stop here after leaving current frame */
   func3 (); /* break here */
   result = bar (b + foo (c));
   return 0; /* advance malformed */
Index: advance.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/advance.exp,v
retrieving revision 1.2
diff -u -r1.2 advance.exp
--- advance.exp	20 Jan 2003 15:40:07 -0000	1.2
+++ advance.exp	3 Feb 2003 05:41:42 -0000
@@ -63,8 +63,12 @@
 # Verify that "advance <funcname>" when funcname is NOT called by the current
 # frame, stops at the end of the current frame.
 #
+# gdb can legitimately stop on either the current line or the next line,
+# depending on whether the machine instruction for 'call' on the current
+# line has more instructions after it or not.
+#
 gdb_test "advance func3" \
-	"in main.*func \\(c\\).*stop here after leaving current frame..."\
+	"(in main|).*(func \\(c\\)|marker1 \\(\\)).*stop here after leaving current frame..."\
 	"advance function not called by current frame"
 
 # break at main again
Index: until.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/until.exp,v
retrieving revision 1.2
diff -u -r1.2 until.exp
--- until.exp	20 Jan 2003 15:40:07 -0000	1.2
+++ until.exp	3 Feb 2003 05:41:43 -0000
@@ -76,6 +76,6 @@
 # stop at main, the caller, where we put the 'guard' breakpoint.
 #
 gdb_test "until marker3" \
-	"$hex in main.*argc.*argv.*envp.*at.*${srcfile}:82.*marker2 \\(43\\)." \
+	"($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:(82.*marker2 \\(43\\)|83.*marker3 \\(.stack., .trace.\\))." \
 	"until func, not called by current frame"
 


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