Fix regexp quoting in gdb.ada test cases

Message ID 20240828133943.929792-1-tromey@adacore.com
State New
Headers
Series Fix regexp quoting in gdb.ada test cases |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom Tromey Aug. 28, 2024, 1:39 p.m. UTC
  I noticed that some gdb.ada tests used regular expressions like:

         "Continuing\..*$inferior_exited_re.*" \

Here, the "\." should either be "." or "\\." -- "\." is not really
meaningful.

This patch fixes all the cases of this I could find in gdb.ada.  In
one test (fun_renaming.exp), using "\\." would result in failures, and
here I rewrote the tests to use -wrap.
---
 gdb/testsuite/gdb.ada/bp_c_mixed_case.exp   |  4 ++--
 gdb/testsuite/gdb.ada/bp_inlined_func.exp   |  2 +-
 gdb/testsuite/gdb.ada/call_pn.exp           |  4 ++--
 gdb/testsuite/gdb.ada/catch_assert_if.exp   |  4 ++--
 gdb/testsuite/gdb.ada/catch_ex.exp          | 16 ++++++++--------
 gdb/testsuite/gdb.ada/catch_ex_std.exp      |  2 +-
 gdb/testsuite/gdb.ada/excep_handle.exp      | 14 +++++++-------
 gdb/testsuite/gdb.ada/fun_overload_menu.exp | 12 ++++++------
 gdb/testsuite/gdb.ada/fun_renaming.exp      | 14 +++++++-------
 gdb/testsuite/gdb.ada/homonym.exp           |  2 +-
 gdb/testsuite/gdb.ada/mi_var_access.exp     |  2 +-
 gdb/testsuite/gdb.ada/operator_bp.exp       |  6 +++---
 gdb/testsuite/gdb.ada/rec_comp.exp          |  2 +-
 gdb/testsuite/gdb.ada/task_bp.exp           |  2 +-
 14 files changed, 43 insertions(+), 43 deletions(-)
  

Comments

Andrew Burgess Aug. 30, 2024, 2:45 p.m. UTC | #1
Tom Tromey <tromey@adacore.com> writes:

> I noticed that some gdb.ada tests used regular expressions like:
>
>          "Continuing\..*$inferior_exited_re.*" \
>
> Here, the "\." should either be "." or "\\." -- "\." is not really
> meaningful.
>
> This patch fixes all the cases of this I could find in gdb.ada.  In
> one test (fun_renaming.exp), using "\\." would result in failures, and
> here I rewrote the tests to use -wrap.

LGTM.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

> ---
>  gdb/testsuite/gdb.ada/bp_c_mixed_case.exp   |  4 ++--
>  gdb/testsuite/gdb.ada/bp_inlined_func.exp   |  2 +-
>  gdb/testsuite/gdb.ada/call_pn.exp           |  4 ++--
>  gdb/testsuite/gdb.ada/catch_assert_if.exp   |  4 ++--
>  gdb/testsuite/gdb.ada/catch_ex.exp          | 16 ++++++++--------
>  gdb/testsuite/gdb.ada/catch_ex_std.exp      |  2 +-
>  gdb/testsuite/gdb.ada/excep_handle.exp      | 14 +++++++-------
>  gdb/testsuite/gdb.ada/fun_overload_menu.exp | 12 ++++++------
>  gdb/testsuite/gdb.ada/fun_renaming.exp      | 14 +++++++-------
>  gdb/testsuite/gdb.ada/homonym.exp           |  2 +-
>  gdb/testsuite/gdb.ada/mi_var_access.exp     |  2 +-
>  gdb/testsuite/gdb.ada/operator_bp.exp       |  6 +++---
>  gdb/testsuite/gdb.ada/rec_comp.exp          |  2 +-
>  gdb/testsuite/gdb.ada/task_bp.exp           |  2 +-
>  14 files changed, 43 insertions(+), 43 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp b/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
> index 8ab5f03c084..2286e463514 100644
> --- a/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
> +++ b/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
> @@ -92,14 +92,14 @@ gdb_test "p <NoDebugMixedCaseFunc>" \
>  
>  set test "break <MixedCaseFunc>, in C"
>  gdb_test_multiple "break <MixedCaseFunc>" $test {
> -	-re "Function \"<MixedCaseFunc>\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
> +	-re "Function \"<MixedCaseFunc>\" not defined\\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
>  		gdb_test_no_output "n" $test
>  	}
>  }
>  
>  set test "break <NoDebugMixedCaseFunc>, in C"
>  gdb_test_multiple "break <NoDebugMixedCaseFunc>" $test {
> -	-re "Function \"<NoDebugMixedCaseFunc>\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
> +	-re "Function \"<NoDebugMixedCaseFunc>\" not defined\\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
>  		gdb_test_no_output "n" $test
>  	}
>  }
> diff --git a/gdb/testsuite/gdb.ada/bp_inlined_func.exp b/gdb/testsuite/gdb.ada/bp_inlined_func.exp
> index 761d103ed9a..db56a11d12a 100644
> --- a/gdb/testsuite/gdb.ada/bp_inlined_func.exp
> +++ b/gdb/testsuite/gdb.ada/bp_inlined_func.exp
> @@ -48,5 +48,5 @@ for {set i 0} {$i < 4} {incr i} {
>  }
>  
>  gdb_test "continue" \
> -         "Continuing\..*$inferior_exited_re.*" \
> +         "Continuing\\..*$inferior_exited_re.*" \
>           "continuing to program completion"
> diff --git a/gdb/testsuite/gdb.ada/call_pn.exp b/gdb/testsuite/gdb.ada/call_pn.exp
> index 5d3f9d67f8a..5d7e828b584 100644
> --- a/gdb/testsuite/gdb.ada/call_pn.exp
> +++ b/gdb/testsuite/gdb.ada/call_pn.exp
> @@ -45,8 +45,8 @@ set xfail_re \
>      [multi_line \
>  	 "Multiple matches for last_node_id" \
>  	 "\\\[0\\\] cancel" \
> -	 "\\\[1\\\] pck\.last_node_id at .*.adb:17" \
> -	 "\\\[2\\\] pck\.last_node_id at .*.adb:17" \
> +	 "\\\[1\\\] pck\\.last_node_id at .*.adb:17" \
> +	 "\\\[2\\\] pck\\.last_node_id at .*.adb:17" \
>  	 "> $"]
>  
>  # Make sure that last_node_id is set to zero...
> diff --git a/gdb/testsuite/gdb.ada/catch_assert_if.exp b/gdb/testsuite/gdb.ada/catch_assert_if.exp
> index 312b7aa1ef1..48b1c85b8bc 100644
> --- a/gdb/testsuite/gdb.ada/catch_assert_if.exp
> +++ b/gdb/testsuite/gdb.ada/catch_assert_if.exp
> @@ -52,9 +52,9 @@ set bp_location [gdb_get_line_number "STOP" ${testdir}/bla.adb]
>  set catchpoint_msg \
>    "Catchpoint $decimal, failed assertion at $hex in bla \\\(\\\).*at .*bla.adb:$bp_location"
>  gdb_test "continue" \
> -	 "Continuing\.$eol$eol$catchpoint_msg$eol.*STOP" \
> +	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*STOP" \
>           "continuing to expected failed assertion"
>  
>  gdb_test "continue" \
> -         "Continuing\..*$inferior_exited_re.*" \
> +         "Continuing\\..*$inferior_exited_re.*" \
>           "continuing to program completion"
> diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
> index 0fcc0137271..48ace254e24 100644
> --- a/gdb/testsuite/gdb.ada/catch_ex.exp
> +++ b/gdb/testsuite/gdb.ada/catch_ex.exp
> @@ -55,13 +55,13 @@ gdb_test "info break" \
>  set catchpoint_msg \
>    "Catchpoint $any_nb, CONSTRAINT_ERROR (\\\(ignore C_E\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
>  gdb_test "continue" \
> -	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT1" \
> +	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT1" \
>           "continuing to first exception"
>  
>  set catchpoint_msg \
>    "Catchpoint $any_nb, PROGRAM_ERROR (\\\(foo\\.adb:$decimal explicit raise\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
>  gdb_test "continue" \
> -	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT2" \
> +	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT2" \
>           "continuing to second exception"
>  
>  ################################################
> @@ -108,23 +108,23 @@ gdb_test "info break" \
>  set catchpoint_msg \
>    "Catchpoint $any_nb, PROGRAM_ERROR (\\\(foo.adb:$decimal explicit raise\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
>  gdb_test "continue" \
> -	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT2" \
> +	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT2" \
>           "continuing to Program_Error exception"
>  
>  set catchpoint_msg \
>    "Catchpoint $any_nb, failed assertion at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
>  gdb_test "continue" \
> -	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT3" \
> +	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT3" \
>           "continuing to failed assertion"
>  
>  set catchpoint_msg \
>    "Catchpoint $any_nb, unhandled CONSTRAINT_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
>  gdb_test "continue" \
> -	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT4" \
> +	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT4" \
>           "continuing to unhandled exception"
>  
>  gdb_test "continue" \
> -         "Continuing\..*$inferior_exited_re.*" \
> +         "Continuing\\..*$inferior_exited_re.*" \
>           "continuing to program completion"
>  
>  #################################
> @@ -148,12 +148,12 @@ gdb_test "tcatch exception" \
>  set temp_catchpoint_msg \
>    "Temporary catchpoint $any_nb, CONSTRAINT_ERROR (\\\(.*\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
>  gdb_test "continue" \
> -	 "Continuing\.$eol$eol$temp_catchpoint_msg$eol.*SPOT1" \
> +	 "Continuing\\.$eol$eol$temp_catchpoint_msg$eol.*SPOT1" \
>           "continuing to temporary catchpoint"
>  
>  with_test_prefix "temporary catchpoint" {
>      gdb_test "continue" \
> -	"Continuing\..*$inferior_exited_re.*" \
> +	"Continuing\\..*$inferior_exited_re.*" \
>  	"continuing to program completion"
>  }
>  
> diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp
> index dbd3729940d..2eae854162c 100644
> --- a/gdb/testsuite/gdb.ada/catch_ex_std.exp
> +++ b/gdb/testsuite/gdb.ada/catch_ex_std.exp
> @@ -73,7 +73,7 @@ gdb_test "catch exception some_kind_of_error" \
>      "Catchpoint \[0-9\]+: `some_kind_of_error' Ada exception"
>  
>  gdb_test "cont" \
> -    "Catchpoint \[0-9\]+, .* at .*foo\.adb:\[0-9\]+.*" \
> +    "Catchpoint \[0-9\]+, .* at .*foo\\.adb:\[0-9\]+.*" \
>      "caught the exception"
>  
>  gdb_test "print \$_ada_exception = some_package.some_kind_of_error'Address" \
> diff --git a/gdb/testsuite/gdb.ada/excep_handle.exp b/gdb/testsuite/gdb.ada/excep_handle.exp
> index ad92affed65..2a99457ddcd 100644
> --- a/gdb/testsuite/gdb.ada/excep_handle.exp
> +++ b/gdb/testsuite/gdb.ada/excep_handle.exp
> @@ -55,7 +55,7 @@ gdb_test "catch handlers" \
>  # Continue.  The program should stop at first exception handling.
>  
>  gdb_test "continue" \
> -    "Continuing\.$eol$eol$catchpoint_constraint_error_msg" \
> +    "Continuing\\.$eol$eol$catchpoint_constraint_error_msg" \
>      "continuing to first Constraint_Error exception handlers"
>  
>  # Resume the program's exception.
> @@ -66,7 +66,7 @@ gdb_test "continue" \
>  # the next exception being raised.
>  
>  gdb_test "continue" \
> -    "Continuing\.$eol$eol$catchpoint_storage_error_msg" \
> +    "Continuing\\.$eol$eol$catchpoint_storage_error_msg" \
>      "continuing and stopping in Storage_Error exception handlers"
>  
>  gdb_test_no_output "delete 2" \
> @@ -85,7 +85,7 @@ gdb_test "catch handlers Program_Error" \
>  # Continue, we should not stop at ABORT_SIGNAL but at Program_Error one.
>  
>  gdb_test "continue" \
> -    "Continuing\.$eol$eol$catchpoint_program_error_msg" \
> +    "Continuing\\.$eol$eol$catchpoint_program_error_msg" \
>      "continuing without stopping to Program_Error exception handlers"
>  
>  gdb_test_no_output \
> @@ -101,7 +101,7 @@ gdb_test "catch handlers Storage_Error" \
>  # Continue, we should stop at Storage_Error handlers.
>  
>  gdb_test "continue" \
> -    "Continuing\.$eol$eol$catchpoint_storage_error_msg" \
> +    "Continuing\\.$eol$eol$catchpoint_storage_error_msg" \
>      "continuing without stopping to Storage_Error exception handlers"
>  
>  gdb_test_no_output \
> @@ -126,7 +126,7 @@ gdb_test "info breakpoint" "stop only if Global_Var = 2" \
>  # Continue, we should not stop at ABORT_SIGNAL but at Program_Error one.
>  
>  gdb_test "continue" \
> -    "Continuing\.$eol$eol$catchpoint_constraint_error_msg" \
> +    "Continuing\\.$eol$eol$catchpoint_constraint_error_msg" \
>      "continuing to second Constraint_Error exception handlers"
>  
>  gdb_test_no_output \
> @@ -148,11 +148,11 @@ gdb_test "catch handlers Program_Error if Global_Var = 4" \
>  # the second one.
>  
>  gdb_test "continue" \
> -    "Continuing\.$eol$eol$catchpoint_program_error_msg" \
> +    "Continuing\\.$eol$eol$catchpoint_program_error_msg" \
>      "continuing to Program_Error exception handlers"
>  
>  # Continue, the program should exit properly.
>  
>  gdb_test "continue" \
> -         "Continuing\..*$inferior_exited_re.*" \
> +         "Continuing\\..*$inferior_exited_re.*" \
>           "continuing to program completion"
> diff --git a/gdb/testsuite/gdb.ada/fun_overload_menu.exp b/gdb/testsuite/gdb.ada/fun_overload_menu.exp
> index ec5465d30a2..8e7a3fbafa7 100644
> --- a/gdb/testsuite/gdb.ada/fun_overload_menu.exp
> +++ b/gdb/testsuite/gdb.ada/fun_overload_menu.exp
> @@ -54,8 +54,8 @@ proc test_menu {expr function menu_entries selection output} {
>  with_test_prefix "func" {
>      test_menu "f (1, null)" "f" \
>  	[multi_line \
> -	     "\\\[1\\\] foo\.f \\(integer; foo\.integer_access\\) return boolean at .*foo.adb:.*" \
> -	     "\\\[2\\\] foo\.f \\(foo\.new_integer; foo\.integer_access\\) return boolean at .*foo.adb:.*"] \
> +	     "\\\[1\\\] foo\\.f \\(integer; foo\\.integer_access\\) return boolean at .*foo.adb:.*" \
> +	     "\\\[2\\\] foo\\.f \\(foo\\.new_integer; foo\\.integer_access\\) return boolean at .*foo.adb:.*"] \
>  	"1" "= true"
>  }
>  
> @@ -63,8 +63,8 @@ with_test_prefix "func" {
>  with_test_prefix "proc" {
>      test_menu "p (1, null)" "p" \
>  	[multi_line \
> -	     "\\\[1\\\] foo\.p \\(integer; foo\.integer_access\\) at .*foo.adb:.*" \
> -	     "\\\[2\\\] foo\.p \\(foo\.new_integer; foo\.integer_access\\) at .*foo.adb:.*" ] \
> +	     "\\\[1\\\] foo\\.p \\(integer; foo\\.integer_access\\) at .*foo.adb:.*" \
> +	     "\\\[2\\\] foo\\.p \\(foo\\.new_integer; foo\\.integer_access\\) at .*foo.adb:.*" ] \
>  	"1" "= (void)"
>  }
>  
> @@ -73,7 +73,7 @@ gdb_test "set ada print-signatures off" ""
>  with_test_prefix "signatures disabled" {
>      test_menu "f (1, null)" "f" \
>  	[multi_line \
> -	     "\\\[1\\\] foo\.f at .*foo.adb:.*" \
> -	     "\\\[2\\\] foo\.f at .*foo.adb:.*"] \
> +	     "\\\[1\\\] foo\\.f at .*foo.adb:.*" \
> +	     "\\\[2\\\] foo\\.f at .*foo.adb:.*"] \
>  	"1" "= true"
>  }
> diff --git a/gdb/testsuite/gdb.ada/fun_renaming.exp b/gdb/testsuite/gdb.ada/fun_renaming.exp
> index 33c9b956754..08c44b7df60 100644
> --- a/gdb/testsuite/gdb.ada/fun_renaming.exp
> +++ b/gdb/testsuite/gdb.ada/fun_renaming.exp
> @@ -37,10 +37,10 @@ gdb_test "print fun_rename_test_next(1)" " = 2"
>  
>  set test "print fun_rename_test_n(1)"
>  gdb_test_multiple $test $test {
> -    -re " = 2\..*$gdb_prompt $"  {
> +    -wrap -re " = 2"  {
>          pass $test
>      }
> -    -re "No definition of \"fun_rename_test_n\" in current context\..*$gdb_prompt $" {
> +    -wrap -re "No definition of \"fun_rename_test_n\" in current context\\." {
>          if {[test_compiler_info {gcc-6*}]} {
>              fail $test
>          } else {
> @@ -51,10 +51,10 @@ gdb_test_multiple $test $test {
>  }
>  set test "print renamed_fun_rename_test_next(1)"
>  gdb_test_multiple $test $test {
> -    -re " = 2\..*$gdb_prompt $" {
> +    -wrap -re " = 2" {
>          pass $test
>      }
> -    -re "No definition of \"renamed_fun_rename_test_next\" in current context\..*$gdb_prompt $" {
> +    -wrap -re "No definition of \"renamed_fun_rename_test_next\" in current context\\." {
>          if {[test_compiler_info {gcc-6*}]} {
>              fail $test
>          } else {
> @@ -65,17 +65,17 @@ gdb_test_multiple $test $test {
>  
>  set test "print pack.renamed_fun_rename_test_next(1)"
>  gdb_test_multiple $test $test {
> -    -re " = 2\..*$gdb_prompt $" {
> +    -wrap -re " = 2" {
>          pass $test
>      }
> -    -re "No definition of \"pack\.renamed_fun_rename_test_next\" in current context\..*$gdb_prompt $" {
> +    -wrap -re "No definition of \"pack\\.renamed_fun_rename_test_next\" in current context\\." {
>          if {[test_compiler_info {gcc-6*}]} {
>              fail $test
>          } else {
>              xfail $test
>          }
>      }
> -    -re "Type <data variable, no debug info> is not a structure or union type\..*$gdb_prompt $" {
> +    -wrap -re "Type <data variable, no debug info> is not a structure or union type\\." {
>          if {[test_compiler_info {gcc-6*}]} {
>              fail $test
>          } else {
> diff --git a/gdb/testsuite/gdb.ada/homonym.exp b/gdb/testsuite/gdb.ada/homonym.exp
> index 64a6edfa23e..91a4e62e61f 100644
> --- a/gdb/testsuite/gdb.ada/homonym.exp
> +++ b/gdb/testsuite/gdb.ada/homonym.exp
> @@ -76,7 +76,7 @@ gdb_test "print lcl" \
>  
>  set bp_location [gdb_get_line_number "BREAK_2" ${testdir}/homonym.adb]
>  gdb_test "break homonym.adb:$bp_location" \
> -         "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*homonym\.adb, line \[0-9\]+\." \
> +         "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*homonym\\.adb, line \[0-9\]+\\." \
>           "break at BREAK_2"
>  
>  gdb_test "continue" \
> diff --git a/gdb/testsuite/gdb.ada/mi_var_access.exp b/gdb/testsuite/gdb.ada/mi_var_access.exp
> index e797a1576cb..15419bb6629 100644
> --- a/gdb/testsuite/gdb.ada/mi_var_access.exp
> +++ b/gdb/testsuite/gdb.ada/mi_var_access.exp
> @@ -41,7 +41,7 @@ mi_continue_to_line \
>  # The value of NUMCHILD may vary on different systems.  Use generic $decimal
>  # to match possible values.
>  set re_ok "\\^done,name=\"A_String_Access\",numchild=\"$decimal\",.*"
> -set re_error "\\^error,msg=\"Value out of range\.\".*"
> +set re_error "\\^error,msg=\"Value out of range\\.\".*"
>  set re_error2 "\\^error,msg=\"Cannot access memory at address $hex\""
>  mi_gdb_test "-var-create A_String_Access * A_String_Access" \
>      "($re_ok|$re_error|$re_error2)" \
> diff --git a/gdb/testsuite/gdb.ada/operator_bp.exp b/gdb/testsuite/gdb.ada/operator_bp.exp
> index ff81a9f4ce4..2335d492798 100644
> --- a/gdb/testsuite/gdb.ada/operator_bp.exp
> +++ b/gdb/testsuite/gdb.ada/operator_bp.exp
> @@ -36,7 +36,7 @@ runto "ops_test.adb:$bp_location"
>  set bp_re "Breakpoint $decimal at $hex"
>  foreach op { "+" "-" } {
>      set op_re [string_to_regexp $op]
> -    gdb_test "break \"$op\"" "$bp_re: \"$op_re\"\. \\($decimal locations\\).*"
> +    gdb_test "break \"$op\"" "$bp_re: \"$op_re\"\\. \\($decimal locations\\).*"
>  }
>  
>  foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
> @@ -45,7 +45,7 @@ foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&"
>  	-re -wrap "$bp_re: file .*ops.adb, line $decimal." {
>  	    pass $gdb_test_name
>  	}
> -	-re -wrap "$bp_re: \"$op_re\"\. \\($decimal locations\\).*" {
> +	-re -wrap "$bp_re: \"$op_re\"\\. \\($decimal locations\\).*" {
>  	    pass $gdb_test_name
>  	}
>      }
> @@ -72,7 +72,7 @@ runto "ops_test.adb:$bp_location"
>  foreach op { "+" "-" } {
>      set op_re [string_to_regexp $op]
>      gdb_test "break ops.\"$op\"" \
> -             "Breakpoint $decimal at $hex: ops\\.\"$op_re\"\. \\(2 locations\\)"
> +             "Breakpoint $decimal at $hex: ops\\.\"$op_re\"\\. \\(2 locations\\)"
>  }
>  
>  foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
> diff --git a/gdb/testsuite/gdb.ada/rec_comp.exp b/gdb/testsuite/gdb.ada/rec_comp.exp
> index 46387869840..641ebb6f3cb 100644
> --- a/gdb/testsuite/gdb.ada/rec_comp.exp
> +++ b/gdb/testsuite/gdb.ada/rec_comp.exp
> @@ -33,6 +33,6 @@ if {![runto "bar_o203_012.adb:$bp_location"]} {
>  gdb_test "whatis r.ia" " = bar_o203_012.int_access"
>  
>  gdb_test "ptype r" \
> -    " = record\r\n *ia: bar_o203_012\.int_access;\r\nend record"
> +    " = record\r\n *ia: bar_o203_012\\.int_access;\r\nend record"
>  
>  gdb_test "ptype r.ia" " = access <$decimal-byte integer>"
> diff --git a/gdb/testsuite/gdb.ada/task_bp.exp b/gdb/testsuite/gdb.ada/task_bp.exp
> index cf6251e4b45..4b32a3d6c2a 100644
> --- a/gdb/testsuite/gdb.ada/task_bp.exp
> +++ b/gdb/testsuite/gdb.ada/task_bp.exp
> @@ -37,7 +37,7 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" }
>  
>  proc test_bp { loc msg } {
>     gdb_test "break $loc" \
> -     "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*pck.adb, line \[0-9\]+\." \
> +     "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*pck.adb, line \[0-9\]+\\." \
>       "break $loc - $msg"
>  
>     gdb_run_cmd
> -- 
> 2.45.0
  

Patch

diff --git a/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp b/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
index 8ab5f03c084..2286e463514 100644
--- a/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
+++ b/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
@@ -92,14 +92,14 @@  gdb_test "p <NoDebugMixedCaseFunc>" \
 
 set test "break <MixedCaseFunc>, in C"
 gdb_test_multiple "break <MixedCaseFunc>" $test {
-	-re "Function \"<MixedCaseFunc>\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
+	-re "Function \"<MixedCaseFunc>\" not defined\\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
 		gdb_test_no_output "n" $test
 	}
 }
 
 set test "break <NoDebugMixedCaseFunc>, in C"
 gdb_test_multiple "break <NoDebugMixedCaseFunc>" $test {
-	-re "Function \"<NoDebugMixedCaseFunc>\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
+	-re "Function \"<NoDebugMixedCaseFunc>\" not defined\\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
 		gdb_test_no_output "n" $test
 	}
 }
diff --git a/gdb/testsuite/gdb.ada/bp_inlined_func.exp b/gdb/testsuite/gdb.ada/bp_inlined_func.exp
index 761d103ed9a..db56a11d12a 100644
--- a/gdb/testsuite/gdb.ada/bp_inlined_func.exp
+++ b/gdb/testsuite/gdb.ada/bp_inlined_func.exp
@@ -48,5 +48,5 @@  for {set i 0} {$i < 4} {incr i} {
 }
 
 gdb_test "continue" \
-         "Continuing\..*$inferior_exited_re.*" \
+         "Continuing\\..*$inferior_exited_re.*" \
          "continuing to program completion"
diff --git a/gdb/testsuite/gdb.ada/call_pn.exp b/gdb/testsuite/gdb.ada/call_pn.exp
index 5d3f9d67f8a..5d7e828b584 100644
--- a/gdb/testsuite/gdb.ada/call_pn.exp
+++ b/gdb/testsuite/gdb.ada/call_pn.exp
@@ -45,8 +45,8 @@  set xfail_re \
     [multi_line \
 	 "Multiple matches for last_node_id" \
 	 "\\\[0\\\] cancel" \
-	 "\\\[1\\\] pck\.last_node_id at .*.adb:17" \
-	 "\\\[2\\\] pck\.last_node_id at .*.adb:17" \
+	 "\\\[1\\\] pck\\.last_node_id at .*.adb:17" \
+	 "\\\[2\\\] pck\\.last_node_id at .*.adb:17" \
 	 "> $"]
 
 # Make sure that last_node_id is set to zero...
diff --git a/gdb/testsuite/gdb.ada/catch_assert_if.exp b/gdb/testsuite/gdb.ada/catch_assert_if.exp
index 312b7aa1ef1..48b1c85b8bc 100644
--- a/gdb/testsuite/gdb.ada/catch_assert_if.exp
+++ b/gdb/testsuite/gdb.ada/catch_assert_if.exp
@@ -52,9 +52,9 @@  set bp_location [gdb_get_line_number "STOP" ${testdir}/bla.adb]
 set catchpoint_msg \
   "Catchpoint $decimal, failed assertion at $hex in bla \\\(\\\).*at .*bla.adb:$bp_location"
 gdb_test "continue" \
-	 "Continuing\.$eol$eol$catchpoint_msg$eol.*STOP" \
+	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*STOP" \
          "continuing to expected failed assertion"
 
 gdb_test "continue" \
-         "Continuing\..*$inferior_exited_re.*" \
+         "Continuing\\..*$inferior_exited_re.*" \
          "continuing to program completion"
diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
index 0fcc0137271..48ace254e24 100644
--- a/gdb/testsuite/gdb.ada/catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex.exp
@@ -55,13 +55,13 @@  gdb_test "info break" \
 set catchpoint_msg \
   "Catchpoint $any_nb, CONSTRAINT_ERROR (\\\(ignore C_E\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
 gdb_test "continue" \
-	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT1" \
+	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT1" \
          "continuing to first exception"
 
 set catchpoint_msg \
   "Catchpoint $any_nb, PROGRAM_ERROR (\\\(foo\\.adb:$decimal explicit raise\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
 gdb_test "continue" \
-	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT2" \
+	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT2" \
          "continuing to second exception"
 
 ################################################
@@ -108,23 +108,23 @@  gdb_test "info break" \
 set catchpoint_msg \
   "Catchpoint $any_nb, PROGRAM_ERROR (\\\(foo.adb:$decimal explicit raise\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
 gdb_test "continue" \
-	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT2" \
+	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT2" \
          "continuing to Program_Error exception"
 
 set catchpoint_msg \
   "Catchpoint $any_nb, failed assertion at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
 gdb_test "continue" \
-	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT3" \
+	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT3" \
          "continuing to failed assertion"
 
 set catchpoint_msg \
   "Catchpoint $any_nb, unhandled CONSTRAINT_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
 gdb_test "continue" \
-	 "Continuing\.$eol$eol$catchpoint_msg$eol.*SPOT4" \
+	 "Continuing\\.$eol$eol$catchpoint_msg$eol.*SPOT4" \
          "continuing to unhandled exception"
 
 gdb_test "continue" \
-         "Continuing\..*$inferior_exited_re.*" \
+         "Continuing\\..*$inferior_exited_re.*" \
          "continuing to program completion"
 
 #################################
@@ -148,12 +148,12 @@  gdb_test "tcatch exception" \
 set temp_catchpoint_msg \
   "Temporary catchpoint $any_nb, CONSTRAINT_ERROR (\\\(.*\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb"
 gdb_test "continue" \
-	 "Continuing\.$eol$eol$temp_catchpoint_msg$eol.*SPOT1" \
+	 "Continuing\\.$eol$eol$temp_catchpoint_msg$eol.*SPOT1" \
          "continuing to temporary catchpoint"
 
 with_test_prefix "temporary catchpoint" {
     gdb_test "continue" \
-	"Continuing\..*$inferior_exited_re.*" \
+	"Continuing\\..*$inferior_exited_re.*" \
 	"continuing to program completion"
 }
 
diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp
index dbd3729940d..2eae854162c 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex_std.exp
@@ -73,7 +73,7 @@  gdb_test "catch exception some_kind_of_error" \
     "Catchpoint \[0-9\]+: `some_kind_of_error' Ada exception"
 
 gdb_test "cont" \
-    "Catchpoint \[0-9\]+, .* at .*foo\.adb:\[0-9\]+.*" \
+    "Catchpoint \[0-9\]+, .* at .*foo\\.adb:\[0-9\]+.*" \
     "caught the exception"
 
 gdb_test "print \$_ada_exception = some_package.some_kind_of_error'Address" \
diff --git a/gdb/testsuite/gdb.ada/excep_handle.exp b/gdb/testsuite/gdb.ada/excep_handle.exp
index ad92affed65..2a99457ddcd 100644
--- a/gdb/testsuite/gdb.ada/excep_handle.exp
+++ b/gdb/testsuite/gdb.ada/excep_handle.exp
@@ -55,7 +55,7 @@  gdb_test "catch handlers" \
 # Continue.  The program should stop at first exception handling.
 
 gdb_test "continue" \
-    "Continuing\.$eol$eol$catchpoint_constraint_error_msg" \
+    "Continuing\\.$eol$eol$catchpoint_constraint_error_msg" \
     "continuing to first Constraint_Error exception handlers"
 
 # Resume the program's exception.
@@ -66,7 +66,7 @@  gdb_test "continue" \
 # the next exception being raised.
 
 gdb_test "continue" \
-    "Continuing\.$eol$eol$catchpoint_storage_error_msg" \
+    "Continuing\\.$eol$eol$catchpoint_storage_error_msg" \
     "continuing and stopping in Storage_Error exception handlers"
 
 gdb_test_no_output "delete 2" \
@@ -85,7 +85,7 @@  gdb_test "catch handlers Program_Error" \
 # Continue, we should not stop at ABORT_SIGNAL but at Program_Error one.
 
 gdb_test "continue" \
-    "Continuing\.$eol$eol$catchpoint_program_error_msg" \
+    "Continuing\\.$eol$eol$catchpoint_program_error_msg" \
     "continuing without stopping to Program_Error exception handlers"
 
 gdb_test_no_output \
@@ -101,7 +101,7 @@  gdb_test "catch handlers Storage_Error" \
 # Continue, we should stop at Storage_Error handlers.
 
 gdb_test "continue" \
-    "Continuing\.$eol$eol$catchpoint_storage_error_msg" \
+    "Continuing\\.$eol$eol$catchpoint_storage_error_msg" \
     "continuing without stopping to Storage_Error exception handlers"
 
 gdb_test_no_output \
@@ -126,7 +126,7 @@  gdb_test "info breakpoint" "stop only if Global_Var = 2" \
 # Continue, we should not stop at ABORT_SIGNAL but at Program_Error one.
 
 gdb_test "continue" \
-    "Continuing\.$eol$eol$catchpoint_constraint_error_msg" \
+    "Continuing\\.$eol$eol$catchpoint_constraint_error_msg" \
     "continuing to second Constraint_Error exception handlers"
 
 gdb_test_no_output \
@@ -148,11 +148,11 @@  gdb_test "catch handlers Program_Error if Global_Var = 4" \
 # the second one.
 
 gdb_test "continue" \
-    "Continuing\.$eol$eol$catchpoint_program_error_msg" \
+    "Continuing\\.$eol$eol$catchpoint_program_error_msg" \
     "continuing to Program_Error exception handlers"
 
 # Continue, the program should exit properly.
 
 gdb_test "continue" \
-         "Continuing\..*$inferior_exited_re.*" \
+         "Continuing\\..*$inferior_exited_re.*" \
          "continuing to program completion"
diff --git a/gdb/testsuite/gdb.ada/fun_overload_menu.exp b/gdb/testsuite/gdb.ada/fun_overload_menu.exp
index ec5465d30a2..8e7a3fbafa7 100644
--- a/gdb/testsuite/gdb.ada/fun_overload_menu.exp
+++ b/gdb/testsuite/gdb.ada/fun_overload_menu.exp
@@ -54,8 +54,8 @@  proc test_menu {expr function menu_entries selection output} {
 with_test_prefix "func" {
     test_menu "f (1, null)" "f" \
 	[multi_line \
-	     "\\\[1\\\] foo\.f \\(integer; foo\.integer_access\\) return boolean at .*foo.adb:.*" \
-	     "\\\[2\\\] foo\.f \\(foo\.new_integer; foo\.integer_access\\) return boolean at .*foo.adb:.*"] \
+	     "\\\[1\\\] foo\\.f \\(integer; foo\\.integer_access\\) return boolean at .*foo.adb:.*" \
+	     "\\\[2\\\] foo\\.f \\(foo\\.new_integer; foo\\.integer_access\\) return boolean at .*foo.adb:.*"] \
 	"1" "= true"
 }
 
@@ -63,8 +63,8 @@  with_test_prefix "func" {
 with_test_prefix "proc" {
     test_menu "p (1, null)" "p" \
 	[multi_line \
-	     "\\\[1\\\] foo\.p \\(integer; foo\.integer_access\\) at .*foo.adb:.*" \
-	     "\\\[2\\\] foo\.p \\(foo\.new_integer; foo\.integer_access\\) at .*foo.adb:.*" ] \
+	     "\\\[1\\\] foo\\.p \\(integer; foo\\.integer_access\\) at .*foo.adb:.*" \
+	     "\\\[2\\\] foo\\.p \\(foo\\.new_integer; foo\\.integer_access\\) at .*foo.adb:.*" ] \
 	"1" "= (void)"
 }
 
@@ -73,7 +73,7 @@  gdb_test "set ada print-signatures off" ""
 with_test_prefix "signatures disabled" {
     test_menu "f (1, null)" "f" \
 	[multi_line \
-	     "\\\[1\\\] foo\.f at .*foo.adb:.*" \
-	     "\\\[2\\\] foo\.f at .*foo.adb:.*"] \
+	     "\\\[1\\\] foo\\.f at .*foo.adb:.*" \
+	     "\\\[2\\\] foo\\.f at .*foo.adb:.*"] \
 	"1" "= true"
 }
diff --git a/gdb/testsuite/gdb.ada/fun_renaming.exp b/gdb/testsuite/gdb.ada/fun_renaming.exp
index 33c9b956754..08c44b7df60 100644
--- a/gdb/testsuite/gdb.ada/fun_renaming.exp
+++ b/gdb/testsuite/gdb.ada/fun_renaming.exp
@@ -37,10 +37,10 @@  gdb_test "print fun_rename_test_next(1)" " = 2"
 
 set test "print fun_rename_test_n(1)"
 gdb_test_multiple $test $test {
-    -re " = 2\..*$gdb_prompt $"  {
+    -wrap -re " = 2"  {
         pass $test
     }
-    -re "No definition of \"fun_rename_test_n\" in current context\..*$gdb_prompt $" {
+    -wrap -re "No definition of \"fun_rename_test_n\" in current context\\." {
         if {[test_compiler_info {gcc-6*}]} {
             fail $test
         } else {
@@ -51,10 +51,10 @@  gdb_test_multiple $test $test {
 }
 set test "print renamed_fun_rename_test_next(1)"
 gdb_test_multiple $test $test {
-    -re " = 2\..*$gdb_prompt $" {
+    -wrap -re " = 2" {
         pass $test
     }
-    -re "No definition of \"renamed_fun_rename_test_next\" in current context\..*$gdb_prompt $" {
+    -wrap -re "No definition of \"renamed_fun_rename_test_next\" in current context\\." {
         if {[test_compiler_info {gcc-6*}]} {
             fail $test
         } else {
@@ -65,17 +65,17 @@  gdb_test_multiple $test $test {
 
 set test "print pack.renamed_fun_rename_test_next(1)"
 gdb_test_multiple $test $test {
-    -re " = 2\..*$gdb_prompt $" {
+    -wrap -re " = 2" {
         pass $test
     }
-    -re "No definition of \"pack\.renamed_fun_rename_test_next\" in current context\..*$gdb_prompt $" {
+    -wrap -re "No definition of \"pack\\.renamed_fun_rename_test_next\" in current context\\." {
         if {[test_compiler_info {gcc-6*}]} {
             fail $test
         } else {
             xfail $test
         }
     }
-    -re "Type <data variable, no debug info> is not a structure or union type\..*$gdb_prompt $" {
+    -wrap -re "Type <data variable, no debug info> is not a structure or union type\\." {
         if {[test_compiler_info {gcc-6*}]} {
             fail $test
         } else {
diff --git a/gdb/testsuite/gdb.ada/homonym.exp b/gdb/testsuite/gdb.ada/homonym.exp
index 64a6edfa23e..91a4e62e61f 100644
--- a/gdb/testsuite/gdb.ada/homonym.exp
+++ b/gdb/testsuite/gdb.ada/homonym.exp
@@ -76,7 +76,7 @@  gdb_test "print lcl" \
 
 set bp_location [gdb_get_line_number "BREAK_2" ${testdir}/homonym.adb]
 gdb_test "break homonym.adb:$bp_location" \
-         "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*homonym\.adb, line \[0-9\]+\." \
+         "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*homonym\\.adb, line \[0-9\]+\\." \
          "break at BREAK_2"
 
 gdb_test "continue" \
diff --git a/gdb/testsuite/gdb.ada/mi_var_access.exp b/gdb/testsuite/gdb.ada/mi_var_access.exp
index e797a1576cb..15419bb6629 100644
--- a/gdb/testsuite/gdb.ada/mi_var_access.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_access.exp
@@ -41,7 +41,7 @@  mi_continue_to_line \
 # The value of NUMCHILD may vary on different systems.  Use generic $decimal
 # to match possible values.
 set re_ok "\\^done,name=\"A_String_Access\",numchild=\"$decimal\",.*"
-set re_error "\\^error,msg=\"Value out of range\.\".*"
+set re_error "\\^error,msg=\"Value out of range\\.\".*"
 set re_error2 "\\^error,msg=\"Cannot access memory at address $hex\""
 mi_gdb_test "-var-create A_String_Access * A_String_Access" \
     "($re_ok|$re_error|$re_error2)" \
diff --git a/gdb/testsuite/gdb.ada/operator_bp.exp b/gdb/testsuite/gdb.ada/operator_bp.exp
index ff81a9f4ce4..2335d492798 100644
--- a/gdb/testsuite/gdb.ada/operator_bp.exp
+++ b/gdb/testsuite/gdb.ada/operator_bp.exp
@@ -36,7 +36,7 @@  runto "ops_test.adb:$bp_location"
 set bp_re "Breakpoint $decimal at $hex"
 foreach op { "+" "-" } {
     set op_re [string_to_regexp $op]
-    gdb_test "break \"$op\"" "$bp_re: \"$op_re\"\. \\($decimal locations\\).*"
+    gdb_test "break \"$op\"" "$bp_re: \"$op_re\"\\. \\($decimal locations\\).*"
 }
 
 foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
@@ -45,7 +45,7 @@  foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&"
 	-re -wrap "$bp_re: file .*ops.adb, line $decimal." {
 	    pass $gdb_test_name
 	}
-	-re -wrap "$bp_re: \"$op_re\"\. \\($decimal locations\\).*" {
+	-re -wrap "$bp_re: \"$op_re\"\\. \\($decimal locations\\).*" {
 	    pass $gdb_test_name
 	}
     }
@@ -72,7 +72,7 @@  runto "ops_test.adb:$bp_location"
 foreach op { "+" "-" } {
     set op_re [string_to_regexp $op]
     gdb_test "break ops.\"$op\"" \
-             "Breakpoint $decimal at $hex: ops\\.\"$op_re\"\. \\(2 locations\\)"
+             "Breakpoint $decimal at $hex: ops\\.\"$op_re\"\\. \\(2 locations\\)"
 }
 
 foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
diff --git a/gdb/testsuite/gdb.ada/rec_comp.exp b/gdb/testsuite/gdb.ada/rec_comp.exp
index 46387869840..641ebb6f3cb 100644
--- a/gdb/testsuite/gdb.ada/rec_comp.exp
+++ b/gdb/testsuite/gdb.ada/rec_comp.exp
@@ -33,6 +33,6 @@  if {![runto "bar_o203_012.adb:$bp_location"]} {
 gdb_test "whatis r.ia" " = bar_o203_012.int_access"
 
 gdb_test "ptype r" \
-    " = record\r\n *ia: bar_o203_012\.int_access;\r\nend record"
+    " = record\r\n *ia: bar_o203_012\\.int_access;\r\nend record"
 
 gdb_test "ptype r.ia" " = access <$decimal-byte integer>"
diff --git a/gdb/testsuite/gdb.ada/task_bp.exp b/gdb/testsuite/gdb.ada/task_bp.exp
index cf6251e4b45..4b32a3d6c2a 100644
--- a/gdb/testsuite/gdb.ada/task_bp.exp
+++ b/gdb/testsuite/gdb.ada/task_bp.exp
@@ -37,7 +37,7 @@  if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" }
 
 proc test_bp { loc msg } {
    gdb_test "break $loc" \
-     "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*pck.adb, line \[0-9\]+\." \
+     "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*pck.adb, line \[0-9\]+\\." \
      "break $loc - $msg"
 
    gdb_run_cmd