* gdb.base/watchpoint.c (func2): Initialize local_a. Add
authorUlrich Weigand <uweigand@de.ibm.com>
Thu, 2 Aug 2012 15:55:45 +0000 (15:55 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Thu, 2 Aug 2012 15:55:45 +0000 (15:55 +0000)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/watchpoint.c
gdb/testsuite/gdb.base/watchpoint.exp

index b2f3daea85283b949e070a248c3d616b3ee46e9d..6e759667f850a1ca44a04fc7e31de59459efa497 100644 (file)
@@ -1,3 +1,17 @@
+2012-08-02  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * 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.
+
 2012-08-02  Yao Qi  <yao@codesourcery.com>
            Pedro Alves  <palves@redhat.com>
 
index 88c110f273e2ed6d55259e7e9703b9cb6c8fe4ff..e887f99aebbc244110a0329ef09391b9ae935b62 100644 (file)
@@ -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 a461cb2977fc9247faaaa33f1a16da1070a24b5d..b7ae2e1fe384efedbc2790fff671afc20f16db8a 100644 (file)
@@ -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" ""
     }