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: [PATCH 4/5] [gdb/testsuite] Use valnum_re more often (part 3)
Date: Wed, 28 Jan 2026 13:06:25 +0100	[thread overview]
Message-ID: <20260128120626.1032047-5-tdevries@suse.de> (raw)
In-Reply-To: <20260128120626.1032047-1-tdevries@suse.de>

Also transform '\\\$\[0-9\].*' into valnum_re, assuming that '\\\$\[0-9\]+' was
meant.

Done using these commands to cover '\\\$' vs '\\$' and '\[0-9\]' vs '\[0-9]':
...
find gdb/testsuite/ -type f -name *.exp* \
    | xargs sed -i 's/\\\\\\$\\\[0-9\\\]\.\*/${::valnum_re}/g'
find gdb/testsuite/ -type f -name *.exp* \
    | xargs sed -i 's/\\\\\\$\\\[0-9\]\.\*/${::valnum_re}/g'
find gdb/testsuite/ -type f -name *.exp* \
    | xargs sed -i 's/\\\\$\\\[0-9\\\]\.\*/${::valnum_re}/g'
find gdb/testsuite/ -type f -name *.exp* \
    | xargs sed -i 's/\\\\$\\\[0-9\]\.\*/${::valnum_re}/g'
...
---
 gdb/testsuite/gdb.cp/m-static.exp  | 20 +++++++--------
 gdb/testsuite/gdb.cp/namespace.exp | 40 +++++++++++++++---------------
 gdb/testsuite/gdb.cp/nsimport.exp  |  6 ++---
 3 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp
index 05516d918ac..939e1880d64 100644
--- a/gdb/testsuite/gdb.cp/m-static.exp
+++ b/gdb/testsuite/gdb.cp/m-static.exp
@@ -139,33 +139,33 @@ gdb_test "print test2.key1" "${::valnum_re} = 5" "derived template object, base
 gdb_test "print test2.key2" "${::valnum_re} = 77" "derived template object, base static long"
 
 # derived template object, base static enum
-gdb_test "print test2.value" "\\$\[0-9\].* = oriental" "derived template object, base static enum"
+gdb_test "print test2.value" "${::valnum_re} = oriental" "derived template object, base static enum"
 
 # derived template object, static enum
-gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum"
+gdb_test "print test2.value_derived" "${::valnum_re} = etruscan" "derived template object, static enum"
 
 # Three.
 
 # template object, static derived template data member's base static const bool
-gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool"
+gdb_test "print test3.data.test" "${::valnum_re} = true" "template object, static const bool"
 
 # template object, static derived template data member's base static const int
-gdb_test "print test3.data.key1" "\\$\[0-9\].* = 5" "template object, static const int"
+gdb_test "print test3.data.key1" "${::valnum_re} = 5" "template object, static const int"
 
 # template object, static derived template data member's base static long
-gdb_test "print test3.data.key2" "\\$\[0-9\].* = 77" "template object, static long"
+gdb_test "print test3.data.key2" "${::valnum_re} = 77" "template object, static long"
 
 # template object, static derived template data member's base static enum
-gdb_test "print test3.data.value" "\\$\[0-9\].* = oriental" "template object, static enum"
+gdb_test "print test3.data.value" "${::valnum_re} = oriental" "template object, static enum"
 
 #  template object, static derived template data member's static enum
-gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum"
+gdb_test "print test3.data.value_derived" "${::valnum_re} = etruscan" "template object, static derived enum"
 
 # 2002-08-16
 # Four.
 
 # static const int initialized in another file.
-gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere"
+gdb_test "print test4.elsewhere" "${::valnum_re} = 221" "static const int initialized elsewhere"
 
 # static const int that nobody initializes.  From PR gdb/635.
 if {[test_compiler_info {gcc-[0-3]-*}]
@@ -184,9 +184,9 @@ gdb_test "print test4" "static nowhere = <optimized out>.*" "static const int in
 
 # static const initialized in the class definition, PR gdb/11702.
 if { $non_dwarf } { setup_xfail *-*-* }
-gdb_test "print test4.everywhere" "\\$\[0-9\].* = 317" "static const int initialized in class definition"
+gdb_test "print test4.everywhere" "${::valnum_re} = 317" "static const int initialized in class definition"
 if { $non_dwarf } { setup_xfail *-*-* }
-gdb_test "print test4.somewhere" "\\$\[0-9\].* = 3.14\[0-9\]*" "static const float initialized in class definition"
+gdb_test "print test4.somewhere" "${::valnum_re} = 3.14\[0-9\]*" "static const float initialized in class definition"
 
 # Also make sure static const members can be found via "info var".
 if { $non_dwarf } { setup_xfail *-*-* }
diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp
index 50fa4c843b1..6c5dd667060 100644
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -150,8 +150,8 @@ gdb_test "whatis C::cOtherFileType" "type = short"
 gdb_test "whatis ::C::cOtherFileType" "type = short"
 gdb_test "whatis C::cOtherFileVar" "type = const C::cOtherFileType"
 gdb_test "whatis ::C::cOtherFileVar" "type = const C::cOtherFileType"
-gdb_test "print C::cOtherFileVar" "\\$\[0-9\].* = 319"
-gdb_test "print ::C::cOtherFileVar" "\\$\[0-9\].* = 319"
+gdb_test "print C::cOtherFileVar" "${::valnum_re} = 319"
+gdb_test "print ::C::cOtherFileVar" "${::valnum_re} = 319"
 
 if {$xfail_class_types} { setup_xfail *-*-* }
 gdb_test "whatis C::OtherFileClass::cOtherFileClassType" "type = short"
@@ -169,7 +169,7 @@ gdb_test_multiple $test $test {
 
 	gdb_test $test2 " = 318"
     }
-    -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
+    -re "${::valnum_re} = 318\r\n$gdb_prompt $" {
 	# Do not permit to XFAIL on recent GCCs.
 	if {$xfail_class_types} {
 	    setup_xfail *-*-*
@@ -194,15 +194,15 @@ if {![runto "C::D::marker2"]} {
     return
 }
 
-gdb_test "print c" "\\$\[0-9\].* = 1"
+gdb_test "print c" "${::valnum_re} = 1"
 gdb_test "print cc" "No symbol \"cc\" in current context."
-gdb_test "print 'C::cc'" "\\$\[0-9\].* = 2"
-gdb_test "print C::cc" "\\$\[0-9\].* = 2"
-gdb_test "print cd" "\\$\[0-9\].* = 3"
+gdb_test "print 'C::cc'" "${::valnum_re} = 2"
+gdb_test "print C::cc" "${::valnum_re} = 2"
+gdb_test "print cd" "${::valnum_re} = 3"
 gdb_test "print C::D::cd" "No type \"D\" within class or namespace \"C::C\"."
-gdb_test "print 'E::cde'" "\\$\[0-9\].* = 5"
-gdb_test "print E::cde" "\\$\[0-9\].* = 5"
-gdb_test "print shadow" "\\$\[0-9\].* = 13"
+gdb_test "print 'E::cde'" "${::valnum_re} = 5"
+gdb_test "print E::cde" "${::valnum_re} = 5"
+gdb_test "print shadow" "${::valnum_re} = 13"
 gdb_test "print E::ce" "No symbol \"ce\" in namespace \"C::D::E\"."
 gdb_test "ptype C" "type = namespace C::C"
 gdb_test "ptype E" "type = namespace C::D::E"
@@ -219,7 +219,7 @@ gdb_test "ptype C::NestedClass" "No symbol \"NestedClass\" in namespace \"C::C\"
 
 # Tests involving multiple files
 
-gdb_test "print cOtherFile" "\\$\[0-9\].* = 316"
+gdb_test "print cOtherFile" "${::valnum_re} = 316"
 gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n  public:|struct C::OtherFileClass \{)\r\n    int z;\r\n.*\}"
 gdb_test "ptype ::C::OtherFileClass" "type = class C::OtherFileClass \{\r\n  public:\r\n    int z;\r\n.*\}"
 gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"C::C\"."
@@ -233,19 +233,19 @@ gdb_test "ptype ::C::OtherFileClass" $expect "ptype ::C::OtherFileClass typedefs
 
 # Some anonymous namespace tests.
 
-gdb_test "print cX" "\\$\[0-9\].* = 6"
-gdb_test "print 'F::cXf'" "\\$\[0-9\].* = 7"
-gdb_test "print F::cXf" "\\$\[0-9\].* = 7"
-gdb_test "print F::cXfX" "\\$\[0-9\].* = 8"
-gdb_test "print X" "\\$\[0-9\].* = 9"
-gdb_test "print 'G::Xg'" "\\$\[0-9\].* = 10"
-gdb_test "print G::Xg" "\\$\[0-9\].* = 10"
-gdb_test "print G::XgX" "\\$\[0-9\].* = 11"
+gdb_test "print cX" "${::valnum_re} = 6"
+gdb_test "print 'F::cXf'" "${::valnum_re} = 7"
+gdb_test "print F::cXf" "${::valnum_re} = 7"
+gdb_test "print F::cXfX" "${::valnum_re} = 8"
+gdb_test "print X" "${::valnum_re} = 9"
+gdb_test "print 'G::Xg'" "${::valnum_re} = 10"
+gdb_test "print G::Xg" "${::valnum_re} = 10"
+gdb_test "print G::XgX" "${::valnum_re} = 11"
 gdb_test "print cXOtherFile" "No symbol \"cXOtherFile\" in current context."
 gdb_test "print XOtherFile" "No symbol \"XOtherFile\" in current context."
 
 # Enum tests.
-gdb_test "print AAA::ALPHA" "\\$\[0-9\].* = AAA::ALPHA"
+gdb_test "print AAA::ALPHA" "${::valnum_re} = AAA::ALPHA"
 
 # Regression tests for PR 9496.
 gdb_test "whatis ::C::CClass::NestedClass" "type = C::CClass::NestedClass"
diff --git a/gdb/testsuite/gdb.cp/nsimport.exp b/gdb/testsuite/gdb.cp/nsimport.exp
index cc713bd0b78..bab4701f16f 100644
--- a/gdb/testsuite/gdb.cp/nsimport.exp
+++ b/gdb/testsuite/gdb.cp/nsimport.exp
@@ -31,6 +31,6 @@ if {![runto_main]} {
     return
 }
 
-gdb_test "print x" "\\$\[0-9\].* = 11"
-gdb_test "print xx" "\\$\[0-9\].* = 22"
-gdb_test "print xxx" "\\$\[0-9\].* = 33"
+gdb_test "print x" "${::valnum_re} = 11"
+gdb_test "print xx" "${::valnum_re} = 22"
+gdb_test "print xxx" "${::valnum_re} = 33"
-- 
2.51.0


  parent reply	other threads:[~2026-01-28 12:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28 12:06 [PATCH 0/5] [gdb/testsuite] Use valnum_re more often Tom de Vries
2026-01-28 12:06 ` [PATCH 1/5] [gdb/testsuite] Remove superfluous definition of valnum_re in gdb.base/commands.exp Tom de Vries
2026-01-28 12:06 ` [PATCH 2/5] [gdb/testsuite] Use valnum_re more often (part 1) Tom de Vries
2026-01-28 12:06 ` [PATCH 3/5] [gdb/testsuite] Use valnum_re more often (part 2) Tom de Vries
2026-01-28 12:06 ` Tom de Vries [this message]
2026-01-28 12:06 ` [PATCH 5/5] [gdb/testsuite] Use valnum_re more often (part 4) Tom de Vries
2026-02-02 17:05 ` [PATCH 0/5] [gdb/testsuite] Use valnum_re more often Kevin Buettner
2026-02-03 11:14 ` 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=20260128120626.1032047-5-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