Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa/testsuite] Add test for PR gdb/38
@ 2003-03-17 18:35 David Carlton
  2003-03-17 19:42 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: David Carlton @ 2003-03-17 18:35 UTC (permalink / raw)
  To: gdb-patches

This patch adds a KFAILed test for PR gdb/38.  That PR is about
watchpoints set at the same location as breakpoints, which can cause
the watchpoint to get triggered late.  Right now, the only testsuite
case that tests this is in gdb.c++/annota2.exp, which is bad because
it has nothing to do with C++, nothing to do with annotation, and
because level 2 annotation is on its way out.  So I'd like to get the
bug recorded in a more correct location.

Tested on i686-pc-linux-gnu, GCC 3.1, DWARF 2.  I haven't been able to
test the pass branch, because it reliably fails on this platform, but
I did try to be careful with the pass regexp.

OK to commit?

David Carlton
carlton@math.stanford.edu

2003-03-17  David Carlton  <carlton@math.stanford.edu>

	* gdb.base/watchpoint.exp (test_watchpoint_and_breakpoint): New
	test, for PR breakpoints/38.
	Call test_watchpoint_and_breakpoint.
	* gdb.base/watchpoint.c (func3): New function.
	(main): Call func3.

Index: watchpoint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.exp,v
retrieving revision 1.7
diff -u -p -r1.7 watchpoint.exp
--- watchpoint.exp	4 Feb 2003 22:49:19 -0000	1.7
+++ watchpoint.exp	17 Mar 2003 18:29:11 -0000
@@ -648,6 +648,27 @@ proc test_complex_watchpoint {} {
     }
 }
 
+proc test_watchpoint_and_breakpoint {} {
+    global gdb_prompt
+
+    # This is a test for PR gdb/38, which involves setting a
+    # watchpoint right after you've reached a breakpoint.
+
+    if [runto func3] then {
+	gdb_breakpoint [gdb_get_line_number "second x assignment"]
+	gdb_continue_to_breakpoint "second x assignment"
+	gdb_test "watch x" ".*atchpoint \[0-9\]+: x"
+	gdb_test_multiple "next" "next after watch x" {
+	    -re ".*atchpoint \[0-9\]+: x\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*$gdb_prompt $" {
+		pass "next after watch x"
+	    }
+	    -re "\[0-9\]+\[\t \]+y = 1;\r\n$gdb_prompt $" {
+		kfail "gdb/38" "next after watch x"
+	    }
+	}
+    }
+}
+    
 # Start with a fresh gdb.
 
 gdb_exit
@@ -799,6 +820,17 @@ if [initialize] then {
         timeout {fail "(timeout) access watches disallowed"}
       }
     }
+
+    # See above.
+    if [istarget "mips-idt-*"] then {
+	gdb_exit
+	gdb_start
+	gdb_reinitialize_dir $srcdir/$subdir
+	gdb_load $binfile
+	initialize
+    }
+
+    test_watchpoint_and_breakpoint
 }
 
 # Restore old timeout
Index: watchpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 watchpoint.c
--- watchpoint.c	28 Jun 1999 16:04:22 -0000	1.1.1.2
+++ watchpoint.c	17 Mar 2003 18:29:07 -0000
@@ -83,6 +83,18 @@ func2 ()
   static_b = local_a;
 }
 
+void
+func3 ()
+{
+  int x;
+  int y;
+
+  x = 0;
+  x = 1;				/* second x assignment */
+  y = 1;
+  y = 2;
+}
+
 int
 func1 ()
 {
@@ -170,5 +182,8 @@ int main ()
   recurser (2);
 
   marker6 ();
+
+  func3 ();
+
   return 0;
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-17 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-17 18:35 [rfa/testsuite] Add test for PR gdb/38 David Carlton
2003-03-17 19:42 ` Daniel Jacobowitz
2003-03-17 19:52   ` David Carlton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox