From: Tom de Vries Date: Mon, 27 Sep 2021 08:16:57 +0000 (+0200) Subject: [gdb/testsuite] Test sw watchpoint in gdb.threads/process-dies-while-detaching.exp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=203a9824347042e0f7580994cbe7a1eb8dc1e893;p=binutils-gdb.git [gdb/testsuite] Test sw watchpoint in gdb.threads/process-dies-while-detaching.exp The test-case gdb.threads/process-dies-while-detaching.exp takes about 20s when using hw watchpoints, but when forcing sw watchpoints (using the patch mentioned in PR28375#c0), the test-case takes instead 3m14s. Also, it show a FAIL: ... (gdb) continue^M Continuing.^M Cannot find user-level thread for LWP 10324: generic error^M (gdb) FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: continue: watchpoint: continue ... for which PR28375 was filed. Modify the test-case to: - add the hw/sw axis to the watchpoint testing, to ensure that we observe the sw watchpoint behaviour also on can-use-hw-watchpoints architectures. - skip the hw breakpoint testing if not supported - set the sw watchpoint later to avoid making the test too slow. This still triggers the same PR, but now takes just 24s. This patch adds a KFAIL for PR28375. Tested on x86_64-linux. --- diff --git a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp index ac1aad26ec5..ab5a82bef71 100644 --- a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp +++ b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp @@ -235,8 +235,12 @@ proc test_detach {multi_process cmd} { # Same as test_detach, except set a watchpoint before detaching. -proc test_detach_watch {multi_process cmd} { - with_test_prefix "watchpoint" { +proc test_detach_watch {wp multi_process cmd} { + if { $wp == "hw" && [skip_hw_watchpoint_tests] } { + unsupported "hw watchpoint" + return + } + with_test_prefix "watchpoint:$wp" { global binfile decimal clean_restart ${binfile} @@ -254,15 +258,28 @@ proc test_detach_watch {multi_process cmd} { gdb_continue_to_breakpoint "child_function" ".*" } - # Set a watchpoint in the child. - gdb_test "watch globalvar" ".* watchpoint $decimal: globalvar" + if { $wp == "hw" } { + # Set a watchpoint in the child. + gdb_test "watch globalvar" ".* watchpoint $decimal: globalvar" - # Continue to the _exit breakpoint. This arms the watchpoint - # registers in all threads. Detaching will thus need to clear - # them out, and handle the case of the thread disappearing - # while doing that (on targets that need to detach from each - # thread individually). - continue_to_exit_bp + # Continue to the _exit breakpoint. This arms the watchpoint + # registers in all threads. Detaching will thus need to clear + # them out, and handle the case of the thread disappearing + # while doing that (on targets that need to detach from each + # thread individually). + continue_to_exit_bp + } else { + # Force software watchpoints. + gdb_test_no_output "set can-use-hw-watchpoints 0" + + # As above, but flip order, other wise things take too long. + continue_to_exit_bp + gdb_test "watch globalvar" "Watchpoint $decimal: globalvar" + + if { $multi_process == 0 && $cmd == "continue" } { + setup_kfail "gdb/28375" "*-*-*" + } + } do_detach $multi_process $cmd "normal" } @@ -332,7 +349,9 @@ proc do_test {multi_process cmd} { } test_detach $multi_process $cmd - test_detach_watch $multi_process $cmd + foreach wp {"sw" "hw"} { + test_detach_watch $wp $multi_process $cmd + } test_detach_killed_outside $multi_process $cmd }