From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 5/7] [gdb/testsuite] Work around namespace problem in tclint plugin
Date: Wed, 14 Oct 2026 16:58:36 +0200 [thread overview]
Message-ID: <20261014145838.3560108-6-tdevries@suse.de> (raw)
In-Reply-To: <20261014145838.3560108-1-tdevries@suse.de>
I noticed that tclint checks don't work in Term::_log_cur uses in tuiterm
procs.
The problem is that while calls using Term::_log_cur are checked, the ones
using plain _log_cur aren't.
I've filed a tclint issue about this [1].
Work around this in the tclint plugin, and fix the fallout in lib/tuiterm.exp.
[1] https://github.com/nmoroze/tclint/issues/174
---
gdb/testsuite/lib/tuiterm.exp | 30 +++++++++++++++---------------
gdb/testsuite/tclint-plugin.py | 6 ++++++
2 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 71682785eea..6140d32872f 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -133,7 +133,7 @@ proc Term::_ctl_0x08 { {bw -1} } {
}
# Wrap to previous line.
- set _cur_col [expr $_cols - 1]
+ set _cur_col [expr {$_cols - 1}]
incr _cur_row -1
}
}
@@ -162,8 +162,8 @@ proc Term::_ctl_0x0a {} {
# cursor back on the screen. But we wrap the
# scrolling inside a while loop just to be on the safe
# side.
- for {set y 0} {$y < [expr $_rows - 1]} {incr y} {
- set next_y [expr $y + 1]
+ for {set y 0} {$y < $_rows - 1} {incr y} {
+ set next_y [expr {$y + 1}]
_copy_line $next_y $y
}
@@ -226,13 +226,13 @@ proc Term::_csi_@ {args} {
# Move characters right of the cursor right by N positions,
# starting with the rightmost one.
- for {set in_col [expr $_cols - $n - 1]} {$in_col >= $_cur_col} {incr in_col -1} {
- set out_col [expr $in_col + $n]
+ for {set in_col [expr {$_cols - $n - 1}]} {$in_col >= $_cur_col} {incr in_col -1} {
+ set out_col [expr {$in_col + $n}]
set _chars($out_col,$_cur_row) $_chars($in_col,$_cur_row)
}
# Write N blank spaces starting from the cursor.
- _clear_in_line $_cur_col [expr $_cur_col + $n] $_cur_row
+ _clear_in_line $_cur_col [expr {$_cur_col + $n}] $_cur_row
}
}
@@ -339,7 +339,7 @@ proc Term::_csi_G {args} {
variable _cur_col
variable _cols
- set _cur_col [expr {min ($arg, $_cols)} - 1]
+ set _cur_col [expr {min ($arg, $_cols) - 1}]
}
}
@@ -402,7 +402,7 @@ proc Term::_csi_J {args} {
} elseif {$arg == 1} {
# Beginning of display to cursor (inclusive).
_clear_lines 0 $_cur_row
- _clear_in_line 0 [expr $_cur_col + 1] $_cur_row
+ _clear_in_line 0 [expr {$_cur_col + 1}] $_cur_row
} elseif {$arg == 2} {
# Entire display.
_clear_lines 0 $_rows
@@ -426,7 +426,7 @@ proc Term::_csi_K {args} {
_clear_in_line $_cur_col $_cols $_cur_row
} elseif {$arg == 1} {
# Beginning of line to cursor (inclusive).
- _clear_in_line 0 [expr $_cur_col + 1] $_cur_row
+ _clear_in_line 0 [expr {$_cur_col + 1}] $_cur_row
} elseif {$arg == 2} {
# Entire line.
_clear_in_line 0 $_cols $_cur_row
@@ -493,7 +493,7 @@ proc Term::_csi_L {args} {
incr next_y -1
}
- _clear_lines $_cur_row [expr $_cur_row + $arg]
+ _clear_lines $_cur_row [expr {$_cur_row + $arg}]
}
}
@@ -531,8 +531,8 @@ proc Term::_csi_P {args} {
variable _cols
# Move all characters right of the cursor N positions left.
- set out_col [expr $_cur_col]
- set in_col [expr $_cur_col + $count]
+ set out_col $_cur_col
+ set in_col [expr {$_cur_col + $count}]
while {$in_col < $_cols} {
set _chars($out_col,$_cur_row) $_chars($in_col,$_cur_row)
@@ -664,7 +664,7 @@ proc Term::_csi_d {args} {
variable _cur_row
variable _rows
- set _cur_row [expr min ($row - 1, $_rows - 1)]
+ set _cur_row [expr {min ($row - 1, $_rows - 1)}]
}
}
@@ -886,13 +886,13 @@ proc Term::_csi_m {args} {
set _attrs(invisible) 0
}
30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 {
- set _attrs(fg) [_color_attr [expr $item - 30]]
+ set _attrs(fg) [_color_attr [expr {$item - 30}]]
}
39 {
set _attrs(fg) default
}
40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 {
- set _attrs(bg) [_color_attr [expr $item - 40]]
+ set _attrs(bg) [_color_attr [expr {$item - 40}]]
}
49 {
set _attrs(bg) default
diff --git a/gdb/testsuite/tclint-plugin.py b/gdb/testsuite/tclint-plugin.py
index 5a09397c3a7..afe959dea3a 100644
--- a/gdb/testsuite/tclint-plugin.py
+++ b/gdb/testsuite/tclint-plugin.py
@@ -207,8 +207,14 @@ commands = commands_schema(
"with_ansi_styling_terminal": _with_ansi_styling_terminal,
"with_lock": _with_lock,
"with_rocm_gpu_lock": _with_rocm_gpu_lock,
+ # Calls without explicit namespace prefix are not caught, so for now
+ # we add both. This may clash with procs outside the namespace.
+ # https://github.com/nmoroze/tclint/issues/174
"Term::_log_cur": _ns_term_log_cur,
+ "_log_cur": _ns_term_log_cur,
"Term::with_term": _ns_term_with_term,
+ "with_term": _ns_term_with_term,
"Term::with_tuiterm": _ns_term_with_tuiterm,
+ "with_tuiterm": _ns_term_with_tuiterm,
}
)
--
2.51.0
next prev parent reply other threads:[~2026-10-14 15:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 14:58 [pushed 0/7] [gdb/testsuite] Tuiterm maintenance Tom de Vries
2026-10-14 14:58 ` [pushed 1/7] [gdb/testsuite] Remove unused declarations in lib/tuiterm.exp Tom de Vries
2026-10-14 14:58 ` [pushed 2/7] [gdb/testsuite] Factor out Term::_copy_line Tom de Vries
2026-10-14 14:58 ` [pushed 3/7] [gdb/testsuite] Factor out small_initial in gdb.tui/tuiterm.exp Tom de Vries
2026-10-14 14:58 ` [pushed 4/7] [gdb/testsuite] Add Term::check_size Tom de Vries
2026-10-14 14:58 ` Tom de Vries [this message]
2026-10-14 14:58 ` [pushed 6/7] [gdb/testsuite] Fix typo in tclint-plugin.py Tom de Vries
2026-10-14 14:58 ` [pushed 7/7] [gdb/testsuite] Fix test names in gdb.tui/tuiterm.exp Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261014145838.3560108-6-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox