diff options
author | Tom Tromey <tromey@adacore.com> | 2023-02-15 14:57:10 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-02-23 12:50:30 -0700 |
commit | eb94f4278737e6df934d7064ebbd87e4d95ad9d7 (patch) | |
tree | b1fd404ddcd3c4c59c426f575e694c22efe443ac /gdb | |
parent | c32ea73114dfdd161098f11f2590acd71603a397 (diff) | |
download | gdb-eb94f4278737e6df934d7064ebbd87e4d95ad9d7.zip gdb-eb94f4278737e6df934d7064ebbd87e4d95ad9d7.tar.gz gdb-eb94f4278737e6df934d7064ebbd87e4d95ad9d7.tar.bz2 |
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.base/completion.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/step-over-no-symbols.exp | 6 | ||||
-rw-r--r-- | 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 1533acb..4686e6f 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 00b32de..1136b47 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 66a5d31..669a5f6 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 |