This is the mail archive of the gdb-patches@sourceware.org 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]

mi*-watch.exp: Test both hardware and software watchpoints


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


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