public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix Tcl quoting in gdb_assert
@ 2023-02-23 19:52 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-02-23 19:52 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eb94f4278737e6df934d7064ebbd87e4d95ad9d7
commit eb94f4278737e6df934d7064ebbd87e4d95ad9d7
Author: Tom Tromey <tromey@adacore.com>
Date: Wed Feb 15 14:57:10 2023 -0700
Fix Tcl quoting in gdb_assert
The gdb_assert proc under-quotes the expression that is passed in.
This leads to weird code in a couple of spots that tries to
compensate:
gdb_assert {{$all_regs eq $completed_regs}} ...
The fix is to add a bit of quoting when evaluating the expression.
Diff:
---
gdb/testsuite/gdb.base/completion.exp | 2 +-
gdb/testsuite/gdb.base/step-over-no-symbols.exp | 6 +++---
gdb/testsuite/lib/gdb.exp | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 1533acbf4f9..4686e6f8f34 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -159,7 +159,7 @@ foreach {-> reg} [regexp -all -inline -line {^info registers (\w+\S*)} $regs_out
lappend completed_regs $reg
}
set completed_regs [join [lsort $completed_regs]]
-gdb_assert {{$all_regs eq $completed_regs}} "complete 'info registers '"
+gdb_assert {$all_regs eq $completed_regs} "complete 'info registers '"
# Tests below are about tab-completion, which doesn't work if readline
# library isn't used. Check it first.
diff --git a/gdb/testsuite/gdb.base/step-over-no-symbols.exp b/gdb/testsuite/gdb.base/step-over-no-symbols.exp
index 00b32deacf7..1136b47571b 100644
--- a/gdb/testsuite/gdb.base/step-over-no-symbols.exp
+++ b/gdb/testsuite/gdb.base/step-over-no-symbols.exp
@@ -76,9 +76,9 @@ proc test_step_over { displaced } {
set after_addr [get_pc "get after PC"]
- gdb_assert {{[regexp "^${hex}$" $before_addr] \
- && [regexp "^${hex}$" $after_addr] \
- && $before_addr != $after_addr}} "advanced"
+ gdb_assert {[regexp "^${hex}$" $before_addr] \
+ && [regexp "^${hex}$" $after_addr] \
+ && $before_addr != $after_addr} "advanced"
}
foreach displaced { "off" "on" "auto" } {
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 66a5d31d9ad..669a5f606d6 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1942,7 +1942,7 @@ proc gdb_assert { condition {message ""} } {
set message $condition
}
- set code [catch {uplevel 1 expr $condition} res]
+ set code [catch {uplevel 1 [list expr $condition]} res]
if {$code == 1} {
# If code is 1 (TCL_ERROR), it means evaluation failed and res contains
# an error message. Print the error message, and set res to 0 since we
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-23 19:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23 19:52 [binutils-gdb] Fix Tcl quoting in gdb_assert Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).