mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-23 13:21:43 +08:00
Fix regexp quoting in gdb.ada test cases
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>
This commit is contained in:
parent
67e30b1521
commit
bcae3bb650
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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...
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
}
|
||||
|
||||
|
@ -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" \
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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" \
|
||||
|
@ -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)" \
|
||||
|
@ -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"} {
|
||||
|
@ -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>"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user