Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* mi*-watch.exp: Test both hardware and software watchpoints
@ 2007-09-11 15:42 Maciej W. Rozycki
  2007-09-11 16:19 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Maciej W. Rozycki @ 2007-09-11 15:42 UTC (permalink / raw)
  To: gdb-patches, Daniel Jacobowitz; +Cc: Maciej W. Rozycki

Hello,

 This change rearranges how the MI watchpoints tests are done so that both 
hardware and software watchpoints are examined by running the same set of 
tests with both.

 This change has been tested natively for mips-linux-gnu and 
i386-linux-gnu and remotely for mipsisa32-sde-elf, with mips-sim-sde32/-EB 
and mips-sim-sde32/-EL.  The change adds a failure for all the targets for 
previously untested sw watchpoints (mips-linux-gnu fails already for no hw 
watchpoint support for this platform is there still, sigh...) with the 
watchpoint-out-of-scope test like below:

FAIL: gdb.mi/mi-watch.exp: wp out of scope (2)

 The reason for MIPS is (and I suppose for i386 likewise) as soon as the 
frame pointer is destroyed in the callee, the watchpoint vanishes.  There 
is this in_function_epilogue_p() hook that may be used to single-step out 
of the function epilogue which is currently not implemented.

 For MIPS I have a fix for it which I will sent separately and which works 
for non-PIC o32 (tested as above) and should work for all the new ABIs 
(untested).  It does not quite work for o32 PIC, because the GOT pointer 
restoration in the caller is still considered a part of the source line 
associated with the function call.  It is still a step forward though -- 
at least it triggers in the right function and only one load instruction 
too early.

2007-09-11  Maciej W. Rozycki  <macro@mips.com>

	* gdb.mi/mi-watch.exp (test_watchpoint_all): New function.
	Move all the tests here and run them twice, once using software
	watchpoints and once using hardware watchpoints.
	* gdb.mi/mi2-watch.exp (test_watchpoint_all): Likewise.

 OK to apply?

  Maciej

14678.diff
Index: binutils-quilt/src/gdb/testsuite/gdb.mi/mi2-watch.exp
===================================================================
--- binutils-quilt.orig/src/gdb/testsuite/gdb.mi/mi2-watch.exp	2007-09-07 12:50:38.000000000 +0100
+++ binutils-quilt/src/gdb/testsuite/gdb.mi/mi2-watch.exp	2007-09-07 13:03:36.000000000 +0100
@@ -41,10 +41,6 @@
      return -1
 }
 
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-
 proc test_watchpoint_creation_and_listing {} {
     global mi_gdb_prompt
     global srcfile
@@ -167,16 +163,42 @@
     }
 }
 
-# Disable hardware watchpoints if necessary.
+proc test_watchpoint_all {} {
+    upvar srcdir srcdir
+    upvar subdir subdir
+    upvar binfile binfile
+
+    mi_delete_breakpoints
+    mi_gdb_reinitialize_dir $srcdir/$subdir
+    mi_gdb_load ${binfile}
+
+    mi_runto callee4
+    test_watchpoint_creation_and_listing
+    #test_rwatch_creation_and_listing
+    #test_awatch_creation_and_listing
+    test_watchpoint_triggering
+}
+
+# Run the tests twice, once using software watchpoints...
+mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \
+	"567\\^done" \
+	"hw watchpoints toggle"
+test_watchpoint_all
+
+mi_gdb_exit
+
+# ... and unless requested otherwise...
 if [target_info exists gdb,no_hardware_watchpoints] {
-    mi_gdb_test "-gdb-set can-use-hw-watchpoints 0" "\\^done" ""
+    return 0
 }
 
-mi_runto callee4
-test_watchpoint_creation_and_listing
-#test_rwatch_creation_and_listing
-#test_awatch_creation_and_listing
-test_watchpoint_triggering
+mi_gdb_start
+
+# ... once using hardware watchpoints (if available).
+mi_gdb_test "890-gdb-set can-use-hw-watchpoints 1" \
+	"890\\^done" \
+	"hw watchpoints toggle"
+test_watchpoint_all
 
 mi_gdb_exit
 return 0
Index: binutils-quilt/src/gdb/testsuite/gdb.mi/mi-watch.exp
===================================================================
--- binutils-quilt.orig/src/gdb/testsuite/gdb.mi/mi-watch.exp	2007-09-07 12:50:38.000000000 +0100
+++ binutils-quilt/src/gdb/testsuite/gdb.mi/mi-watch.exp	2007-09-07 13:02:52.000000000 +0100
@@ -41,10 +41,6 @@
      return -1
 }
 
-mi_delete_breakpoints
-mi_gdb_reinitialize_dir $srcdir/$subdir
-mi_gdb_load ${binfile}
-
 proc test_watchpoint_creation_and_listing {} {
     global mi_gdb_prompt
     global srcfile
@@ -167,16 +163,42 @@
     }
 }
 
-# Disable hardware watchpoints if necessary.
+proc test_watchpoint_all {} {
+    upvar srcdir srcdir
+    upvar subdir subdir
+    upvar binfile binfile
+
+    mi_delete_breakpoints
+    mi_gdb_reinitialize_dir $srcdir/$subdir
+    mi_gdb_load ${binfile}
+
+    mi_runto callee4
+    test_watchpoint_creation_and_listing
+    #test_rwatch_creation_and_listing
+    #test_awatch_creation_and_listing
+    test_watchpoint_triggering
+}
+
+# Run the tests twice, once using software watchpoints...
+mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \
+	"567\\^done" \
+	"hw watchpoints toggle"
+test_watchpoint_all
+
+mi_gdb_exit
+
+# ... and unless requested otherwise...
 if [target_info exists gdb,no_hardware_watchpoints] {
-    mi_gdb_test "-gdb-set can-use-hw-watchpoints 0" "\\^done" ""
+    return 0
 }
 
-mi_runto callee4
-test_watchpoint_creation_and_listing
-#test_rwatch_creation_and_listing
-#test_awatch_creation_and_listing
-test_watchpoint_triggering
+mi_gdb_start
+
+# ... once using hardware watchpoints (if available).
+mi_gdb_test "890-gdb-set can-use-hw-watchpoints 1" \
+	"890\\^done" \
+	"hw watchpoints toggle"
+test_watchpoint_all
 
 mi_gdb_exit
 return 0


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

end of thread, other threads:[~2007-09-14 16:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-11 15:42 mi*-watch.exp: Test both hardware and software watchpoints Maciej W. Rozycki
2007-09-11 16:19 ` Daniel Jacobowitz
2007-09-14 14:13   ` Maciej W. Rozycki
2007-09-14 14:24     ` Daniel Jacobowitz
2007-09-14 15:28       ` Maciej W. Rozycki
2007-09-14 15:40         ` Daniel Jacobowitz
2007-09-14 16:25           ` Maciej W. Rozycki

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