]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Log on return in Term::_log_cur
authorTom de Vries <tdevries@suse.de>
Thu, 24 Jul 2025 07:18:57 +0000 (09:18 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 24 Jul 2025 07:18:57 +0000 (09:18 +0200)
commitdb47da255d841a0881b8e33c6630df0279149c12
tree243f8faf535b165fb6684c9a0f00db1adfbd7fde
parent673c91580993bc285d75aca2340ae172c7030953
[gdb/testsuite] Log on return in Term::_log_cur

Proc Term::_log_cur logs the cursor update of code in its body argument:
...
    proc _ctl_0x08 {} {
        _log_cur "Backspace" {
            variable _cur_col

            if {$_cur_col > 0} {
                incr _cur_col -1
            }
        }
    }
...
giving us for instance:
...
+++ Backspace, cursor: (2, 0) -> (2, 0)
...

But if we rewrite the code to use a return:
...
    if { $_cur_col == 0 } {
return
    }
    incr _cur_col -1
...
and the return is triggered, the log message disappears.

Fix this by wrapping the "uplevel $body" in a catch:
...
- uplevel $body
+ set code [catch {uplevel $body} result]
...

Tested on aarch64-linux.
gdb/testsuite/lib/tuiterm.exp