]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix regexp quoting in gdb.ada test cases
authorTom Tromey <tromey@adacore.com>
Wed, 28 Aug 2024 13:33:46 +0000 (07:33 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 30 Aug 2024 15:11:12 +0000 (09:11 -0600)
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.

Approved-By: Andrew Burgess <aburgess@redhat.com>
14 files changed:
gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
gdb/testsuite/gdb.ada/bp_inlined_func.exp
gdb/testsuite/gdb.ada/call_pn.exp
gdb/testsuite/gdb.ada/catch_assert_if.exp
gdb/testsuite/gdb.ada/catch_ex.exp
gdb/testsuite/gdb.ada/catch_ex_std.exp
gdb/testsuite/gdb.ada/excep_handle.exp
gdb/testsuite/gdb.ada/fun_overload_menu.exp
gdb/testsuite/gdb.ada/fun_renaming.exp
gdb/testsuite/gdb.ada/homonym.exp
gdb/testsuite/gdb.ada/mi_var_access.exp
gdb/testsuite/gdb.ada/operator_bp.exp
gdb/testsuite/gdb.ada/rec_comp.exp
gdb/testsuite/gdb.ada/task_bp.exp

index 8ab5f03c0846ed7ffe2e30c0e841828c8baabca9..2286e4635144b68f6e4f285c4a5b4de6c75b26a2 100644 (file)
@@ -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
        }
 }
index 761d103ed9ae2bc7ab5a134428306c6ff032fb55..db56a11d12a32fd4aff39bda916beead0b271203 100644 (file)
@@ -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"
index 5d3f9d67f8a7b97306d199820e37b814c976fc0f..5d7e828b5849070ac061157ff842c129f4fd93d5 100644 (file)
@@ -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...
index 312b7aa1ef11bf56aacba9877930fe320a577345..48b1c85b8bc5cb1b769b6e47e1219bcbf473aadf 100644 (file)
@@ -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"
index 0fcc01372711044ade2d0721452b57e6d119883d..48ace254e249da1bddfcde44ebcff7990e9c6b64 100644 (file)
@@ -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"
 }
 
index dbd3729940d958964c7f54e1c30f3277f5285ec7..2eae854162c4bf6d8aed3f3906884735313faf65 100644 (file)
@@ -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" \
index ad92affed65b1fff8faf4d3dd0443801fe6eb547..2a99457ddcd2ba392a71f196eddeaa947b0882d8 100644 (file)
@@ -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"
index ec5465d30a28c9cb74e06842860a75925ba59dff..8e7a3fbafa7d037e87074e349f6f4621488cec13 100644 (file)
@@ -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"
 }
index 33c9b9567545112db90e520a426244cf394c69fd..08c44b7df60befb74f4451db846f6fe53e82c453 100644 (file)
@@ -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 {
index 64a6edfa23ee0990043eb203aff2b0e95d7d0b87..91a4e62e61f2bd65c63b796196b4c014f66345f4 100644 (file)
@@ -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" \
index e797a1576cb045683c648663b595671dac8edf84..15419bb6629dfbd938baf64988514b22520d6311 100644 (file)
@@ -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)" \
index ff81a9f4ce40aace327dacb6ad562dd8dd3d4499..2335d492798bb48658817e8dc49c364373fc543f 100644 (file)
@@ -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"} {
index 4638786984040d568dabf22c250b59749b9765e3..641ebb6f3cb100a9e785b98d39498d43709ffd00 100644 (file)
@@ -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>"
index cf6251e4b457bdcc8483c0e57ded000aecbc6ca6..4b32a3d6c2afb7a712f8c274e2a2f0cabe314559 100644 (file)
@@ -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