Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [pushed 0/6] [gdb/testsuite] Some testsuite fixes
@ 2026-11-06 22:34 Tom de Vries
  2026-11-06 22:34 ` [pushed 1/6] [gdb/testsuite] Fix regexp in gdb.base/solib-overlap.exp Tom de Vries
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Tom de Vries @ 2026-11-06 22:34 UTC (permalink / raw)
  To: gdb-patches

This series contains 6 testsuite patches.

Mostly cleanups after recent commit b32f06001cf ("Change `...'-style quoting
in gdb").

Tom de Vries (6):
  [gdb/testsuite] Fix regexp in gdb.base/solib-overlap.exp
  [gdb/testsuite] Cleanup "Attaching to program" regexps
  [gdb/testsuite] Update regexp in gdb.base/default.exp
  [gdb/testsuite] Update "Interpreter unrecognized" regexp
  [gdb/testsuite] Reformat gdb.cp/classes.exp
  [gdb/testsuite] Update "error in expression, near" regexp

 gdb/testsuite/gdb.base/default.exp            | 17 ++++---
 gdb/testsuite/gdb.base/solib-overlap.exp      |  4 +-
 gdb/testsuite/gdb.cp/classes.exp              | 47 ++++++++++---------
 .../gdb.threads/attach-into-signal.exp        |  4 +-
 gdb/testsuite/gdb.threads/attach-stopped.exp  |  2 +-
 .../main-thread-exit-during-detach.exp        |  3 +-
 gdb/testsuite/lib/mi-support.exp              |  2 +-
 7 files changed, 43 insertions(+), 36 deletions(-)


base-commit: 0251fd7b1fadb77bff42e21f7db6812ab5e13777
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pushed 1/6] [gdb/testsuite] Fix regexp in gdb.base/solib-overlap.exp
  2026-11-06 22:34 [pushed 0/6] [gdb/testsuite] Some testsuite fixes Tom de Vries
@ 2026-11-06 22:34 ` Tom de Vries
  2026-11-06 22:34 ` [pushed 2/6] [gdb/testsuite] Cleanup "Attaching to program" regexps Tom de Vries
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tom de Vries @ 2026-11-06 22:34 UTC (permalink / raw)
  To: gdb-patches

In test-case gdb.base/solib-overlap.exp there's a regexp
"\[Switching to thread $testpid\..*\]".

Because of using double quotes, we have backslash substitution, so for a
testpid of <n>, this transforms into the regexp
{[Switching to thread <n>..*]}, which matches just a single character.

What's meant here is "\\\[Switching to thread $testpid\\..*\\\]".

Fix this using 'subst_vars {}'.
---
 gdb/testsuite/gdb.base/solib-overlap.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index 3fc92d37e90..a94b1f9f6bd 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -102,7 +102,7 @@ foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1"
 	-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
 	    pass $test
 	}
-	-re "Attaching to program.*`?$escapedbinfile\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
+	-re -wrap "[subst_vars {Attaching to program.*`?$escapedbinfile\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*}]" {
 	    # Response expected on Cygwin
 	    pass $test
 	}
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pushed 2/6] [gdb/testsuite] Cleanup "Attaching to program" regexps
  2026-11-06 22:34 [pushed 0/6] [gdb/testsuite] Some testsuite fixes Tom de Vries
  2026-11-06 22:34 ` [pushed 1/6] [gdb/testsuite] Fix regexp in gdb.base/solib-overlap.exp Tom de Vries
@ 2026-11-06 22:34 ` Tom de Vries
  2026-11-06 22:34 ` [pushed 3/6] [gdb/testsuite] Update regexp in gdb.base/default.exp Tom de Vries
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tom de Vries @ 2026-11-06 22:34 UTC (permalink / raw)
  To: gdb-patches

There's a bunch of regexps in some test-cases that check for
"Attaching to program.*`?$escapedbinfile'?".

Drop the optional `' quotes.

While we're at it, make the check a bit more strict by
replacing "Attaching to program.*" with "Attaching to program: ".
---
 gdb/testsuite/gdb.base/solib-overlap.exp                     | 4 ++--
 gdb/testsuite/gdb.threads/attach-into-signal.exp             | 4 ++--
 gdb/testsuite/gdb.threads/attach-stopped.exp                 | 2 +-
 gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp | 3 ++-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index a94b1f9f6bd..1262f53c415 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -99,10 +99,10 @@ foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1"
 
     set test attach
     gdb_test_multiple "attach $testpid" $test {
-	-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
+	-re -wrap "Attaching to program: $escapedbinfile, process $testpid.*" {
 	    pass $test
 	}
-	-re -wrap "[subst_vars {Attaching to program.*`?$escapedbinfile\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*}]" {
+	-re -wrap "[subst_vars {Attaching to program: $escapedbinfile\.exe, process $testpid.*\[Switching to thread $testpid\..*\].*}]" {
 	    # Response expected on Cygwin
 	    pass $test
 	}
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index 2f682ebb073..9dbb675efb6 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -54,13 +54,13 @@ proc corefunc { threadtype executable } {
 	while { $passes < 3 && $attempt <= $attempts } {
 	    set test "attach (pass $passes), pending signal catch"
 	    if {[gdb_test_multiple "attach $testpid" $test {
-		-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.* received signal SIGALRM.*$gdb_prompt $" {
+		-re -wrap "Attaching to program: $escapedbinfile, process $testpid.* received signal SIGALRM.*" {
 		    # nonthreaded:
 		    pass $test
 		    verbose -log "$test succeeded on the attempt # $attempt of $attempts"
 		    set passes [expr {$passes + 1}]
 		}
-		-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
+		-re -wrap "Attaching to program: $escapedbinfile, process $testpid.*" {
 		    set ok 0
 
 		    if { $threadtype == "threaded" } {
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index 2f84c6d77f2..cc60f5bbfb5 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -49,7 +49,7 @@ proc corefunc { threadtype } {
 
     set test "$threadtype: attach2 to stopped, after setting file"
     gdb_test_multiple "attach $testpid" "$test" {
-	-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
+	-re -wrap "Attaching to program: $escapedbinfile, process $testpid.*" {
 	    pass "$test"
 	}
     }
diff --git a/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp b/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp
index 717eca236c0..65f1a1d981d 100644
--- a/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp
+++ b/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp
@@ -71,7 +71,8 @@ proc run_test { spawn_inferior } {
 
 	set escapedbinfile  [string_to_regexp $::binfile]
 	gdb_test -no-prompt-anchor "attach $testpid" \
-	    "Attaching to program.*`?$escapedbinfile'?, process $testpid.*" \
+	    [subst_vars \
+		 {Attaching to program: $escapedbinfile, process $testpid.*}] \
 	    "attach to the inferior"
 
 	# Attaching to a multi-threaded application in non-stop mode
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pushed 3/6] [gdb/testsuite] Update regexp in gdb.base/default.exp
  2026-11-06 22:34 [pushed 0/6] [gdb/testsuite] Some testsuite fixes Tom de Vries
  2026-11-06 22:34 ` [pushed 1/6] [gdb/testsuite] Fix regexp in gdb.base/solib-overlap.exp Tom de Vries
  2026-11-06 22:34 ` [pushed 2/6] [gdb/testsuite] Cleanup "Attaching to program" regexps Tom de Vries
@ 2026-11-06 22:34 ` Tom de Vries
  2026-11-06 22:34 ` [pushed 4/6] [gdb/testsuite] Update "Interpreter unrecognized" regexp Tom de Vries
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tom de Vries @ 2026-11-06 22:34 UTC (permalink / raw)
  To: gdb-patches

Update regexp "You can't do that when your target is `None'" to use
"None" instead.
---
 gdb/testsuite/gdb.base/default.exp | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp
index 5660ce6171e..da1e79bcb5e 100644
--- a/gdb/testsuite/gdb.base/default.exp
+++ b/gdb/testsuite/gdb.base/default.exp
@@ -42,8 +42,9 @@ if {!$use_gdb_stub} {
     gdb_test_multiple "attach" "attach" {
 	-re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\
 	    { pass "attach" }
-	-re "You can't do that when your target is `None'.*$gdb_prompt $"\
-	    { pass "attach" }
+	-re -wrap {You can't do that when your target is "None".*} {
+	    pass "attach"
+	}
 	-re "You can't do that without a process to debug.*$gdb_prompt $"\
 	    { pass "attach" }
 	-re "Don't know how to attach.  Try \"help target\"..*$gdb_prompt $"\
@@ -489,7 +490,7 @@ gdb_test "list" "No symbol table is loaded.  Use the \"file\" command.*"
 # The ``takes a file name'' case is for vxgdb.
 # The ``Use the "file" command'' case is for newer GDB versions which try
 # to deduce the filename from the exec file.
-gdb_test "load" "You can't do that when your target is `None'.*|The load command takes a file name.*|Must specify at least a file name with the load command.*|.*Use the .file. or .exec-file. command.*"
+gdb_test "load" {You can't do that when your target is "None".*|The load command takes a file name.*|Must specify at least a file name with the load command.*|.*Use the .file. or .exec-file. command.*}
 #test next "n" abbreviation
 gdb_test "n" "The program is not being run." "next \"n\" abbreviation"
 #test next
@@ -531,8 +532,9 @@ if {$use_gdb_stub} {
     # Only extended-remote supports "run".
 } else {
     gdb_test_multiple "r" "run \"r\" abbreviation" {
-	-re "Starting program:  .*You can't do that when your target is `None'.*$gdb_prompt $"\
-	    { pass "run \"r\" abbreviation" }
+	-re -wrap {Starting program:  .*You can't do that when your target is "None".*} {
+	    pass "run \"r\" abbreviation"
+	}
 	-re "Starting program:  .*No executable file specified.*Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
 	    { pass "run \"r\" abbreviation" }
 	-re "Starting program:  .*No executable specified, use .target exec.\\..*$gdb_prompt $"\
@@ -553,8 +555,9 @@ if {$use_gdb_stub} {
     # Only extended-remote supports "run".
 } else {
     gdb_test_multiple "run" "run" {
-	-re "Starting program:.*You can't do that when your target is `None'.*$gdb_prompt $"\
-	    { pass "run" }
+	-re -wrap {Starting program:.*You can't do that when your target is "None".*} {
+	    pass "run"
+	}
 	-re "Starting program:  .*No executable file specified.*Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
 	    { pass "run" }
 	-re "Starting program:  .*No executable specified, use .target exec.\\..*$gdb_prompt $"\
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pushed 4/6] [gdb/testsuite] Update "Interpreter unrecognized" regexp
  2026-11-06 22:34 [pushed 0/6] [gdb/testsuite] Some testsuite fixes Tom de Vries
                   ` (2 preceding siblings ...)
  2026-11-06 22:34 ` [pushed 3/6] [gdb/testsuite] Update regexp in gdb.base/default.exp Tom de Vries
@ 2026-11-06 22:34 ` Tom de Vries
  2026-11-06 22:34 ` [pushed 5/6] [gdb/testsuite] Reformat gdb.cp/classes.exp Tom de Vries
  2026-11-06 22:34 ` [pushed 6/6] [gdb/testsuite] Update "error in expression, near" regexp Tom de Vries
  5 siblings, 0 replies; 7+ messages in thread
From: Tom de Vries @ 2026-11-06 22:34 UTC (permalink / raw)
  To: gdb-patches

Update regexp "Interpreter `mi' unrecognized." to use "mi" instead.

Also drop the superfluous dot.
---
 gdb/testsuite/lib/mi-support.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index db8d96dfe99..eee905b2179 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -286,7 +286,7 @@ proc default_mi_gdb_start { { flags {} } } {
 	    unset gdb_spawn_id
 	    return -1
 	}
-	-re ".*Interpreter `mi' unrecognized." {
+	-re {.*Interpreter "mi" unrecognized} {
 	    untested "skip mi tests (not compiled with mi support)."
 	    remote_close host
 	    unset gdb_spawn_id
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pushed 5/6] [gdb/testsuite] Reformat gdb.cp/classes.exp
  2026-11-06 22:34 [pushed 0/6] [gdb/testsuite] Some testsuite fixes Tom de Vries
                   ` (3 preceding siblings ...)
  2026-11-06 22:34 ` [pushed 4/6] [gdb/testsuite] Update "Interpreter unrecognized" regexp Tom de Vries
@ 2026-11-06 22:34 ` Tom de Vries
  2026-11-06 22:34 ` [pushed 6/6] [gdb/testsuite] Update "error in expression, near" regexp Tom de Vries
  5 siblings, 0 replies; 7+ messages in thread
From: Tom de Vries @ 2026-11-06 22:34 UTC (permalink / raw)
  To: gdb-patches

Reformat test-case gdb.cp/classes.exp using emacs auto-indent.

Handle run-away formatting by escaping curly braces.
---
 gdb/testsuite/gdb.cp/classes.exp | 45 +++++++++++++++++---------------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp
index d2fb7c0c14c..84fd575ec3a 100644
--- a/gdb/testsuite/gdb.cp/classes.exp
+++ b/gdb/testsuite/gdb.cp/classes.exp
@@ -513,27 +513,30 @@ proc test_enums {} {
 
     # ptype on the enum member
 
-    set re1 [multi_line \
-	"type = enum ClassWithEnum::PrivEnum (: unsigned (int|short|char) )?{" \
-	"    ?(ClassWithEnum::)?red = 0," \
-	"    (ClassWithEnum::)?green = 1," \
-	"    (ClassWithEnum::)?blue = 2," \
-	"    (ClassWithEnum::)?yellow = 42" \
-	"?}$nl$gdb_prompt $"]
-    set re2 [multi_line \
-	"type = enum PrivEnum {" \
-	"    ?(ClassWithEnum::)?red = 0," \
-	"    (ClassWithEnum::)?green = 1," \
-	"    (ClassWithEnum::)?blue = 2," \
-	"    (ClassWithEnum::)?yellow = 42" \
-	"?}$nl$gdb_prompt $"]
-    set re3 [multi_line \
-	"type = enum {" \
-	"    ?red = 0," \
-	"    green = 1," \
-	"    blue = 2," \
-	"    yellow = 42" \
-	"?}$nl$gdb_prompt $"]
+    set re1 \
+	[multi_line \
+	     "type = enum ClassWithEnum::PrivEnum (: unsigned (int|short|char) )?\{" \
+	     "    ?(ClassWithEnum::)?red = 0," \
+	     "    (ClassWithEnum::)?green = 1," \
+	     "    (ClassWithEnum::)?blue = 2," \
+	     "    (ClassWithEnum::)?yellow = 42" \
+	     "?\}$nl$gdb_prompt $"]
+    set re2 \
+	[multi_line \
+	     "type = enum PrivEnum \{" \
+	     "    ?(ClassWithEnum::)?red = 0," \
+	     "    (ClassWithEnum::)?green = 1," \
+	     "    (ClassWithEnum::)?blue = 2," \
+	     "    (ClassWithEnum::)?yellow = 42" \
+	     "?\}$nl$gdb_prompt $"]
+    set re3 \
+	[multi_line \
+	     "type = enum \{" \
+	     "    ?red = 0," \
+	     "    green = 1," \
+	     "    blue = 2," \
+	     "    yellow = 42" \
+	     "?\}$nl$gdb_prompt $"]
     gdb_test_multiple "ptype obj_with_enum.priv_enum" "ptype obj_with_enum.priv_enum" {
 	-re $re1 {
 	    pass "ptype obj_with_enum.priv_enum"
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pushed 6/6] [gdb/testsuite] Update "error in expression, near" regexp
  2026-11-06 22:34 [pushed 0/6] [gdb/testsuite] Some testsuite fixes Tom de Vries
                   ` (4 preceding siblings ...)
  2026-11-06 22:34 ` [pushed 5/6] [gdb/testsuite] Reformat gdb.cp/classes.exp Tom de Vries
@ 2026-11-06 22:34 ` Tom de Vries
  5 siblings, 0 replies; 7+ messages in thread
From: Tom de Vries @ 2026-11-06 22:34 UTC (permalink / raw)
  To: gdb-patches

Update regexp "A (parse|syntax) error in expression, near `42'" to use
"42" instead.
---
 gdb/testsuite/gdb.cp/classes.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp
index 84fd575ec3a..b4f1c7c34d2 100644
--- a/gdb/testsuite/gdb.cp/classes.exp
+++ b/gdb/testsuite/gdb.cp/classes.exp
@@ -594,7 +594,7 @@ proc test_enums {} {
 	-re "${::valnum_re} = (ClassWithEnum::)?yellow$nl$gdb_prompt $" {
 	    pass "print (ClassWithEnum::PrivEnum) 42"
 	}
-	-re "A (parse|syntax) error in expression, near `42'.$nl$gdb_prompt $" {
+	-re -wrap {A (parse|syntax) error in expression, near "42"[.]} {
 	    # "parse error" is bison 1.35.
 	    # "syntax error" is bison 1.875.
 	    kfail "gdb/1588" "print (ClassWithEnum::PrivEnum) 42"
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-06 22:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 22:34 [pushed 0/6] [gdb/testsuite] Some testsuite fixes Tom de Vries
2026-11-06 22:34 ` [pushed 1/6] [gdb/testsuite] Fix regexp in gdb.base/solib-overlap.exp Tom de Vries
2026-11-06 22:34 ` [pushed 2/6] [gdb/testsuite] Cleanup "Attaching to program" regexps Tom de Vries
2026-11-06 22:34 ` [pushed 3/6] [gdb/testsuite] Update regexp in gdb.base/default.exp Tom de Vries
2026-11-06 22:34 ` [pushed 4/6] [gdb/testsuite] Update "Interpreter unrecognized" regexp Tom de Vries
2026-11-06 22:34 ` [pushed 5/6] [gdb/testsuite] Reformat gdb.cp/classes.exp Tom de Vries
2026-11-06 22:34 ` [pushed 6/6] [gdb/testsuite] Update "error in expression, near" regexp Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox