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]

[testsuite, commit+7.5] Fix watchpoint.exp failures on Cell


Hello,

various targets still show failures in watchpoint.exp:

- test_wide_location_(1|2) need to not expect HW watchpoints on PowerPC

- On SPU, test_complex_watchpoint would fail since the test actually
  watches an uninitialized local variable.  Change the test to always
  initialize the variable before watching it.

- When remote testing on platforms that do not support HW watchpoints
  in the remote protocol (e.g. PowerPC), we consistently need to
  respect gdb,no_hardware_watchpoints by setting can-use-hw-watchpoints
  to 0.  This was not always done.

With the changes below, there are now zero failures in watchpoint.exp
on SPU, PowerPC (32-bit) and PowerPC (64-bit), both in native and
remote testing.

Committed to mainline and 7.5.

Bye,
Ulrich


ChangeLog:

	* gdb.base/watchpoint.c (func2): Initialize local_a.  Add
	marker comment at the beginning (after intialization).
	* gdb.base/watchpoint.exp (test_complex_watchpoint): Set func2
	breakpoint on marker comment instead of function begin.
	(test_wide_location_1): Do not expect HW watchpoints on 32-bit
	PowerPC.
	(test_wide_location_2): Do not expect HW watchpoints on 32-bit
	or 64-bit PowerPC.
	(do_tests): Consistently set can-use-hw-watchpoints to 0 if
	gdb,no_hardware_watchpoints flag is set.
	(initialize): Remove now redundant can-use-hw-watchpoints change.


Index: gdb/testsuite/gdb.base/watchpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.c,v
retrieving revision 1.9
diff -u -p -r1.9 watchpoint.c
--- gdb/testsuite/gdb.base/watchpoint.c	11 Jan 2012 10:36:18 -0000	1.9
+++ gdb/testsuite/gdb.base/watchpoint.c	2 Aug 2012 13:28:33 -0000
@@ -90,9 +90,10 @@ void recurser (x) int  x;
 void
 func2 ()
 {
-  int  local_a;
+  int  local_a = 0;
   static int  static_b;
 
+  /* func2 breakpoint here */
   ival5++;
   local_a = ival5;
   static_b = local_a;
Index: gdb/testsuite/gdb.base/watchpoint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.exp,v
retrieving revision 1.57.2.1
diff -u -p -r1.57.2.1 watchpoint.exp
--- gdb/testsuite/gdb.base/watchpoint.exp	1 Aug 2012 13:05:44 -0000	1.57.2.1
+++ gdb/testsuite/gdb.base/watchpoint.exp	2 Aug 2012 13:28:33 -0000
@@ -54,11 +54,6 @@ proc initialize {} {
     global decimal
     global srcfile
 
-    # Disable hardware watchpoints if necessary.
-    if [target_info exists gdb,no_hardware_watchpoints] {
-	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
-    }
-
     if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] { 
       return 0; 
     }
@@ -455,8 +450,8 @@ proc test_complex_watchpoint {} {
         gdb_test "break marker6" ".*Breakpoint.*"
         gdb_test "cont" "Continuing.*Breakpoint.*marker6 \\(\\).*" \
             "continue to marker6"
-        gdb_test "break func2" ".*Breakpoint.*"
-        gdb_test "cont" "Continuing.*func2.*"
+	gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
+	gdb_continue_to_breakpoint "func2 breakpoint here"
 
         # Test a watch of a single stack-based variable, whose scope
         # is the function we're now in.  This should auto-delete when
@@ -466,7 +461,7 @@ proc test_complex_watchpoint {} {
         gdb_test "cont" "\[Ww\]atchpoint.*local_a.*" "trigger local watch"
         gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" "self-delete local watch"
 
-        gdb_test "cont" "Continuing.*func2.*"
+	gdb_continue_to_breakpoint "func2 breakpoint here"
         # We should be in "func2" again now.  Test a watch of an
         # expression which includes both a stack-based local and
         # something whose scope is larger than this invocation
@@ -486,7 +481,7 @@ proc test_complex_watchpoint {} {
         # across any invocations of "func2", it should not auto-
         # delete.
         #
-        gdb_test "cont" "Continuing.*func2.*"
+	gdb_continue_to_breakpoint "func2 breakpoint here"
         gdb_test "watch static_b" ".*\[Ww\]atchpoint \[0-9\]*: static_b" \
                  "set static local watch"
         gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: static_b.*" \
@@ -611,7 +606,8 @@ proc test_wide_location_1 {} {
     # Platforms where the target can't watch such a large region
     # should clear hw_expected below.
     if { $no_hw || [target_info exists gdb,no_hardware_watchpoints]
-         || [istarget arm*-*-*] } {
+         || [istarget arm*-*-*]
+         || ([istarget powerpc*-*-*] && ![is_lp64_target])} {
 	set hw_expected 0
     } else {
 	set hw_expected 1
@@ -657,7 +653,8 @@ proc test_wide_location_2 {} {
     # Platforms where the target can't watch such a large region
     # should clear hw_expected below.
     if { $no_hw || [target_info exists gdb,no_hardware_watchpoints]
-         || [istarget arm*-*-*] } {
+         || [istarget arm*-*-*]
+         || [istarget powerpc*-*-*]} {
 	set hw_expected 0
     } else {
 	set hw_expected 1
@@ -869,7 +866,7 @@ proc do_tests {} {
 
     clean_restart $testfile
 
-    if {$no_hw} {
+    if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
 
@@ -888,7 +885,7 @@ proc do_tests {} {
     # `initialize' anymore.
     clean_restart $testfile
 
-    if {$no_hw} {
+    if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
 
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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