From: Pedro Alves Date: Mon, 9 Jun 2025 17:27:17 +0000 (+0100) Subject: Adjust gdb.threads/step-over-trips-on-watchpoint.exp for Cygwin (depends on schedlock) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=655c5ad03d3b7c7ff124e107d17e5250ce980b6f;p=thirdparty%2Fbinutils-gdb.git Adjust gdb.threads/step-over-trips-on-watchpoint.exp for Cygwin (depends on schedlock) Change-Id: Ief28e6ebf47abdcd2e71c5f2c70caf2d8753ef5e --- diff --git a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp index 9a028fead19..365dd9dda3d 100644 --- a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp +++ b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp @@ -53,6 +53,20 @@ proc do_test { displaced with_bp } { continue } + gdb_breakpoint "child_function" + + # Don't assume the testcase's child thread has GDB + # thread id 2. On some systems, like e.g., + # Cygwin/Windows the OS/runtime spawns helper threads + # before the child thread is spawned. + set thr_child "unknown" + gdb_test_multiple "c" "run to child thread" { + -re -wrap "Thread ($::decimal) .*hit Breakpoint .*, child_function.*" { + set thr_child $expect_out(1,string) + pass $gdb_test_name + } + } + gdb_test_no_output "set displaced-stepping $displaced" set line [gdb_get_line_number "set wait-thread breakpoint here"] @@ -60,15 +74,15 @@ proc do_test { displaced with_bp } { return } gdb_continue_to_breakpoint "run to wait-thread breakpoint" - gdb_test "info threads" "\\\* 1 .* 2 .*" "info threads shows all threads" + gdb_test "info threads" "\\\* 1 .* $thr_child .*" "info threads shows all threads" gdb_test_no_output "set scheduler-locking on" delete_breakpoints gdb_breakpoint [gdb_get_line_number "set breakpoint child here"] - gdb_test "thread 2" "Switching to .*" - gdb_continue_to_breakpoint "run to breakpoint in thread 2" + gdb_test "thread $thr_child" "Switching to .*" "switch to child thread" + gdb_continue_to_breakpoint "run to breakpoint in child thread" set address_triggers_watch "" set after_address_triggers_watch ""