From: Ulrich Weigand Date: Thu, 2 Aug 2012 15:55:45 +0000 (+0000) Subject: * gdb.base/watchpoint.c (func2): Initialize local_a. Add X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bdddb4dec8340fcf738d014fe772c059eaf06053;p=binutils-gdb.git * 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. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b2f3daea852..6e759667f85 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2012-08-02 Ulrich Weigand + + * 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 Pedro Alves diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c index 88c110f273e..e887f99aebb 100644 --- a/gdb/testsuite/gdb.base/watchpoint.c +++ b/gdb/testsuite/gdb.base/watchpoint.c @@ -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; diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index a461cb2977f..b7ae2e1fe38 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -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" "" }