From: Tom de Vries Date: Wed, 17 Sep 2025 17:07:43 +0000 (+0200) Subject: [gdb/testsuite, tclint] Fix gdb.dap X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1e2056e37d1c82221ccd2657057357e585605aa;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite, tclint] Fix gdb.dap Running tclint on gdb.dap shows these warnings: ... bt-nodebug.exp:74:16: namespace eval received an argument with a \ substitution, unable to parse its arguments [command-args] eof.exp:33:1: expected braced word or word without substitutions in argument \ interpreted as script [command-args] eof.exp:34:1: expected braced word or word without substitutions in argument \ interpreted as script [command-args] ... The first one is for: ... set list_form [namespace eval ton::2list $last_ton] ... I don't think this can be fixed by rewriting into something similar, so ignore this. Likewise in lib/dap-support.exp. The second and third ones are for: ... catch "close -i $gdb_spawn_id" catch "wait -i $gdb_spawn_id" ... which can easily be fixed by using curly braces instead of double quotes, but doing so gets us: ... eof.exp:33:8: unrecognized argument for close: -i [command-args] ... This is because tclint doesn't have support for expect yet [1], so ignore this. While we're at it, fix some trailing whitespace in lib/dap-support. Approved-By: Tom Tromey [1] https://github.com/nmoroze/tclint/issues/118 --- diff --git a/gdb/testsuite/gdb.dap/bt-nodebug.exp b/gdb/testsuite/gdb.dap/bt-nodebug.exp index 3053f8c446f..8188a983734 100644 --- a/gdb/testsuite/gdb.dap/bt-nodebug.exp +++ b/gdb/testsuite/gdb.dap/bt-nodebug.exp @@ -71,6 +71,7 @@ gdb_assert {[dict exists [lindex $breakpoints 0] instructionReference]} \ # slipped in that caused this to be incorrect, so we test both parts # here; to test whether a string was given, we have to reach into the # TON form. +# tclint-disable-next-line command-args set list_form [namespace eval ton::2list $last_ton] set ref [namespace eval ton::2list { get $list_form body breakpoints 0 instructionReference diff --git a/gdb/testsuite/gdb.dap/eof.exp b/gdb/testsuite/gdb.dap/eof.exp index 4752347c157..5c709ed0d8b 100644 --- a/gdb/testsuite/gdb.dap/eof.exp +++ b/gdb/testsuite/gdb.dap/eof.exp @@ -30,8 +30,10 @@ if {[dap_initialize] == ""} { return } -catch "close -i $gdb_spawn_id" -catch "wait -i $gdb_spawn_id" +# Expect support is missing ( https://github.com/nmoroze/tclint/issues/118 ). +# tclint-disable-next-line command-args +catch {close -i $gdb_spawn_id} +catch {wait -i $gdb_spawn_id} unset gdb_spawn_id dap_check_log_file diff --git a/gdb/testsuite/lib/dap-support.exp b/gdb/testsuite/lib/dap-support.exp index 3f0f75ab0ba..2d962e6dd09 100644 --- a/gdb/testsuite/lib/dap-support.exp +++ b/gdb/testsuite/lib/dap-support.exp @@ -117,6 +117,7 @@ proc dap_to_ton {obj} { # Format the object OBJ, in TON format, as JSON and send it to gdb. proc _dap_send_ton {obj} { + # tclint-disable-next-line command-args set json [namespace eval ton::2json $obj] # FIXME this is wrong for non-ASCII characters. set len [string length $json] @@ -170,7 +171,7 @@ proc _dap_read_json {} { } if {$seen_timeout} { - error "timeout reading json header" + error "timeout reading json header" } if {$seen_eof} { error "eof reading json header" @@ -200,7 +201,7 @@ proc _dap_read_json {} { } if {$seen_timeout} { - error "timeout reading json header" + error "timeout reading json header" } if {$seen_eof} { error "eof reading json header" @@ -211,6 +212,7 @@ proc _dap_read_json {} { global last_ton set last_ton [ton::json2ton $json] + # tclint-disable-next-line command-args return [namespace eval ton::2dict $last_ton] }