From: Tom de Vries Date: Fri, 12 Sep 2025 13:04:50 +0000 (+0200) Subject: [gdb/testsuite, tclint] Fix gdb.tui X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=afa2b07bde59756b7a7ca045d75cfc95f0cddac2;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite, tclint] Fix gdb.tui Running tclint on the test-cases in gdb.tui shows a few problems: ... $ ( cd gdb/testsuite/gdb.tui; tclint --ignore line-length *.exp ) compact-source.exp:58:28: expression with substitutions should be enclosed by \ braces [unbraced-expr] compact-source.exp:60:27: expression with substitutions should be enclosed by \ braces [unbraced-expr] compact-source.exp:68:32: expression with substitutions should be enclosed by \ braces [unbraced-expr] empty.exp:68:2: eval received an argument with a substitution, unable to \ parse its arguments [command-args] new-layout.exp:84:2: eval received an argument with a substitution, unable \ to parse its arguments [command-args] source-search.exp:33:25: expression with substitutions should be enclosed by \ braces [unbraced-expr] wrap-line.exp:40:21: expression with substitutions should be enclosed by \ braces [unbraced-expr] wrap-line.exp:44:14: expression with substitutions should be enclosed by \ braces [unbraced-expr] wrap-line.exp:62:40: expression with substitutions should be enclosed by \ braces [unbraced-expr] ... Fix these. Tested on aarch64-linux. --- diff --git a/gdb/testsuite/gdb.tui/compact-source.exp b/gdb/testsuite/gdb.tui/compact-source.exp index 33d8827164e..31bc1dcb5e5 100644 --- a/gdb/testsuite/gdb.tui/compact-source.exp +++ b/gdb/testsuite/gdb.tui/compact-source.exp @@ -55,9 +55,9 @@ set re_border "\\|" set max_line_nr_in_source_file [llength $src_list] # Ensure there are more lines in the window than in the source file. -set src_window_lines [expr $max_line_nr_in_source_file + 2] +set src_window_lines [expr {$max_line_nr_in_source_file + 2}] # Account for border size. -set src_window_size [expr $src_window_lines + 2] +set src_window_size [expr {$src_window_lines + 2}] Term::command "wh src $src_window_size" set re_left_margin "___4_" @@ -65,6 +65,6 @@ set re_left_margin "___4_" Term::check_contents "compact source format" \ "$re_border$re_left_margin$re_line_four *$re_border" -set re_left_margin "___0*[expr $max_line_nr_in_source_file + 1]_" +set re_left_margin "___0*[expr {$max_line_nr_in_source_file + 1}]_" Term::check_contents_not "no surplus line number" \ "$re_border$re_left_margin *$re_border" diff --git a/gdb/testsuite/gdb.tui/empty.exp b/gdb/testsuite/gdb.tui/empty.exp index 33710ff5e8c..c6dad300d34 100644 --- a/gdb/testsuite/gdb.tui/empty.exp +++ b/gdb/testsuite/gdb.tui/empty.exp @@ -65,7 +65,7 @@ set layouts { proc check_boxes {boxes} { set boxno 1 foreach box $boxes { - eval Term::check_box [list "box $boxno"] $box + Term::check_box [list "box $boxno"] {*}$box incr boxno } } diff --git a/gdb/testsuite/gdb.tui/new-layout.exp b/gdb/testsuite/gdb.tui/new-layout.exp index ece164a0ea7..11521b03ca3 100644 --- a/gdb/testsuite/gdb.tui/new-layout.exp +++ b/gdb/testsuite/gdb.tui/new-layout.exp @@ -81,7 +81,7 @@ set layouts \ proc check_boxes {boxes} { set boxno 1 foreach box $boxes { - eval Term::check_box [list "box $boxno"] $box + Term::check_box [list "box $boxno"] {*}$box incr boxno } } diff --git a/gdb/testsuite/gdb.tui/source-search.exp b/gdb/testsuite/gdb.tui/source-search.exp index 41bf1214b78..4fcdca3d0ca 100644 --- a/gdb/testsuite/gdb.tui/source-search.exp +++ b/gdb/testsuite/gdb.tui/source-search.exp @@ -30,7 +30,7 @@ if {![Term::enter_tui]} { } proc check_src_window { testname first_line } { - set last_line [expr $first_line + 12] + set last_line [expr {$first_line + 12}] Term::check_box_contents $testname 0 0 80 15 \ "^\\s+${first_line}\\s+.*\\s+${last_line}\\s+/\\* Line ${last_line} \\*/\\s+$" diff --git a/gdb/testsuite/gdb.tui/wrap-line.exp b/gdb/testsuite/gdb.tui/wrap-line.exp index aa2b1c6ea90..a1ba706654a 100644 --- a/gdb/testsuite/gdb.tui/wrap-line.exp +++ b/gdb/testsuite/gdb.tui/wrap-line.exp @@ -37,11 +37,11 @@ proc fill_line { width } { # Take into account that the prompt also takes space. set prefix [string length "(gdb) "] - set start [expr $prefix + 1] + set start [expr {$prefix + 1}] # Print chars. for { set i $start } { $i <= $width } { incr i } { - set c [expr $i % 10] + set c [expr {$i % 10}] send_gdb $c append res $c } @@ -59,7 +59,7 @@ proc test_wrap { wrap_width tui } { set str [fill_line $wrap_width] # Remaining space on line. - set space [string repeat " " [expr $::cols - $wrap_width]] + set space [string repeat " " [expr {$::cols - $wrap_width}]] # Now print the first char we expect to wrap. send_gdb "W"