Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 2/3] [gdb/testsuite] Refactor gdb.mi/pr11022.exp
Date: Sun,  1 Nov 2026 16:51:52 +0100	[thread overview]
Message-ID: <20261101155153.640893-3-tdevries@suse.de> (raw)
In-Reply-To: <20261101155153.640893-1-tdevries@suse.de>

Refactor test-case gdb.mi/pr11022.exp, to minimize changes in the following
patch:
- add variable parameter to test_memory_changed_observer
- factor out 0/1/42 value regexp

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/pr11022.exp | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/pr11022.exp b/gdb/testsuite/gdb.mi/pr11022.exp
index 8644fadf7ed..f3987da4d75 100644
--- a/gdb/testsuite/gdb.mi/pr11022.exp
+++ b/gdb/testsuite/gdb.mi/pr11022.exp
@@ -24,7 +24,7 @@ if {[build_executable "failed to prepare" $testfile]} {
     return
 }
 
-proc test_memory_changed_observer { mi_command } {
+proc test_memory_changed_observer { var mi_command } {
     with_test_prefix "${mi_command}" {
 	mi_clean_restart $::testfile
 	mi_runto_main
@@ -34,33 +34,39 @@ proc test_memory_changed_observer { mi_command } {
 	    {\^done,bkpt=.number="2",type="breakpoint".*\}} \
 	    "set breakpoint"
 
-	mi_gdb_test "watch x" ".*" "set watchpoint"
+	mi_gdb_test "watch $var" ".*" "set watchpoint"
 
 	mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*" ".*" \
 	    { "" {disp="keep"} } "breakpoint hit"
 
+	set re_0 "0"
+	set re_1 "1"
+	set re_42 "42"
+
 	mi_execute_to "exec-continue" "watchpoint-trigger" "main" "" ".*" ".*" \
 	    [list \
 		 "" \
-		 {wpt={number="3",exp="x"},value={old="0",new="42"}}] \
+		 [subst_vars \
+		      {wpt={number="3",exp="$var"},value={old="$re_0",new="$re_42"}}]] \
 	    "watchpoint hit"
 
 	mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*" ".*" \
 	    { "" {disp="keep"} } "breakpoint hit 2"
 
-	mi_gdb_test "-${mi_command}" {\^done} "set x"
+	mi_gdb_test "-${mi_command}" {\^done} "set $var"
 
 	mi_execute_to "exec-continue" "watchpoint-trigger" "main" "" ".*" ".*" \
 	    [list \
 		 "" \
-		 {wpt={number="3",exp="x"},value={old="1",new="42"}}] \
+		 [subst_vars \
+		      {wpt={number="3",exp="$var"},value={old="$re_1",new="$re_42"}}]] \
 	    "watchpoint hit 2"
 
 	mi_gdb_exit
     }
 }
 
-test_memory_changed_observer {data-write-memory-bytes &x "01"}
+test_memory_changed_observer x {data-write-memory-bytes &x "01"}
 # We want to trigger a target memory write here, so the word size (4 or 8)
 # is not that important.
-test_memory_changed_observer {data-write-memory &x x 4 "01"}
+test_memory_changed_observer x {data-write-memory &x x 4 "01"}
-- 
2.51.0


  parent reply	other threads:[~2026-11-01 15:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01 15:51 [pushed 0/3] [gdb/testsuite] Some gdb.mi/pr11022.exp fixes Tom de Vries
2026-11-01 15:51 ` [pushed 1/3] [gdb/testsuite] Clean up gdb.mi/pr11022.exp Tom de Vries
2026-11-01 15:51 ` Tom de Vries [this message]
2026-11-01 15:51 ` [pushed 3/3] [gdb/testsuite] Fix gdb.mi/pr11022.exp on big endian Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261101155153.640893-3-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox