[binutils-gdb] [gdb/testsuite] Simplify gdb.ada/mi_ex_cond.exp
Tom de Vries
vries@sourceware.org
Sun Feb 22 08:36:10 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9122dc471ad9a2995fd7021dc8678abe5ec6de82
commit 9122dc471ad9a2995fd7021dc8678abe5ec6de82
Author: Tom de Vries <tdevries@suse.de>
Date: Sun Feb 22 09:36:06 2026 +0100
[gdb/testsuite] Simplify gdb.ada/mi_ex_cond.exp
Simplify gdb.ada/mi_ex_cond.exp using the usual tools: subst_vars, quotemeta,
{}.
Also simplify variable syntax: "${::foo}" -> $foo.
The one case where I used subst_vars was where quotemeta forced me to write
out the @DECIMAL expression inside @/.../. I've filed a PR about this [2].
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=33900
Diff:
---
gdb/testsuite/gdb.ada/mi_ex_cond.exp | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond.exp b/gdb/testsuite/gdb.ada/mi_ex_cond.exp
index 91e850a7d56..bc1a569bc53 100644
--- a/gdb/testsuite/gdb.ada/mi_ex_cond.exp
+++ b/gdb/testsuite/gdb.ada/mi_ex_cond.exp
@@ -19,26 +19,23 @@ require allow_ada_tests gnat_runtime_has_debug_info
standard_ada_testfile foo
-if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
+if {[gdb_compile_ada $srcfile $binfile executable [list debug]] != ""} {
return
}
-# A global variable used to simplify the maintenance of some of
-# the regular expressions below.
-set any_nb "${::decimal}"
-
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-if {[mi_clean_restart $::testfile]} {
+if {[mi_clean_restart $testfile]} {
return
}
# And finally, the meat of the testcase... Insert an Ada exception
# catchpoint that uses both conditions and exception name.
-mi_gdb_test "-catch-exception -c \"the_test_index = 2\" -e constraint_error" \
- "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",what=\"`constraint_error' Ada exception\",(.*,)?cond=\"the_test_index = 2\",.*}" \
+mi_gdb_test {-catch-exception -c "the_test_index = 2" -e constraint_error} \
+ [quotemeta \
+ {^done,bkptno="@DECIMAL",bkpt={@...disp="keep",enabled="y",what="`constraint_error' Ada exception",@/(.*,)?/cond="the_test_index = 2",@...}}] \
"catch C_E if the_test_index = 2"
# It is important that we start the program's execution after having
@@ -50,7 +47,8 @@ mi_gdb_test "-catch-exception -c \"the_test_index = 2\" -e constraint_error" \
mi_run_cmd
mi_expect_stop \
- "\"breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"CONSTRAINT_ERROR(\",exception-message=\"foo\\.adb:$decimal explicit raise)?\"" \
+ [subst_vars \
+ {"breakpoint-hit",disp="keep",bkptno="$decimal",exception-name="CONSTRAINT_ERROR"(,exception-message="foo.adb:$decimal explicit raise")?}] \
"foo" "" ".*" ".*" \
".*" \
"run to exception catchpoint hit"
@@ -59,5 +57,6 @@ mi_expect_stop \
# a clobbering of some of the exeption's info.
mi_gdb_test "-break-list" \
- "\\^done,.*,what=\"`constraint_error' Ada exception\",.*,cond=\"the_test_index = 2\",.*" \
+ [quotemeta \
+ {^done,@...,what="`constraint_error' Ada exception",@...,cond="the_test_index = 2",@...}] \
"-break-list"
More information about the Gdb-cvs
mailing list