[binutils-gdb] Adjust gdb.base/memops-watchpoint.exp for Cygwin/Windows

Pedro Alves palves@sourceware.org
Tue Sep 23 10:39:19 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=17956546fd1b7cb4b8bbdceb1c7f4d6f58c891af

commit 17956546fd1b7cb4b8bbdceb1c7f4d6f58c891af
Author: Pedro Alves <pedro@palves.net>
Date:   Tue Feb 11 14:43:39 2025 +0000

    Adjust gdb.base/memops-watchpoint.exp for Cygwin/Windows
    
    When testing gdb.base/memops-watchpoint.exp on Cygwin, I see:
    
     ...
     continue
     Continuing.
    
     Thread 1 "memops-watchpoint" hit Hardware watchpoint 2: -location a[28]
    
     Old value = 104 'h'
     New value = 0 '\000'
     memset () at /usr/src/debug/cygwin-3.5.4-1/winsup/cygwin/x86_64/memset.S:68
     68              rep     stosq
     (gdb) FAIL: gdb.base/memops-watchpoint.exp: continue until memset watchpoint hits
    
    Etc.
    
    This fails on Windows because there all inferiors are multi-threaded
    (because both Windows and the Cygwin runtime spawn helper threads), so
    we always see the
    
      'Thread N "foo" hit'
    
    prefix, which the testcase isn't expecting.
    
    Fix it by optionally expecting such the "Thread ... hit" prefix bit.
    
    Change-Id: Ia06eaf1e152f512f39324d04298e6784eca3e537

Diff:
---
 gdb/testsuite/gdb.base/memops-watchpoint.exp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/memops-watchpoint.exp b/gdb/testsuite/gdb.base/memops-watchpoint.exp
index cabc306887c..c23dac5c2d3 100644
--- a/gdb/testsuite/gdb.base/memops-watchpoint.exp
+++ b/gdb/testsuite/gdb.base/memops-watchpoint.exp
@@ -54,6 +54,8 @@ gdb_test "watch -location c\[28\]" \
 
 proc continue_to_watchpoint {array_re source_function function_re
 			     old_value_re new_value_re} {
+    set thread_prefix_re "(?:Thread $::decimal \[^\r\n\]* hit )?"
+
     set saw_watch_trigger 0
     set saw_function 0
     set is_supported 1
@@ -61,7 +63,7 @@ proc continue_to_watchpoint {array_re source_function function_re
 	[multi_line \
 	     "Continuing\\." \
 	     "" \
-	     "(Hardware w|W)atchpoint ${::decimal}: -location ${array_re}\\\[28\\\]" \
+	     "${thread_prefix_re}(Hardware w|W)atchpoint ${::decimal}: -location ${array_re}\\\[28\\\]" \
 	     "" \
 	     "Old value = ${old_value_re}" \
 	     "New value = ${new_value_re}"]


More information about the Gdb-cvs mailing list