From: Tom Tromey Date: Wed, 15 Feb 2023 21:57:10 +0000 (-0700) Subject: Fix Tcl quoting in gdb_assert X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eb94f4278737e6df934d7064ebbd87e4d95ad9d7;p=binutils-gdb.git 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 --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