From: Tom de Vries Date: Mon, 2 Feb 2026 20:36:48 +0000 (+0100) Subject: [gdb/testsuite] Use valnum_re more often (part 3) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36a29bb5523afdbd58e1e7a7ff327d2dbdf70021;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Use valnum_re more often (part 3) 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' ... Approved-by: Kevin Buettner --- 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 = .*" "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"