[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 <tom@tromey.com>
[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 3053f8c..8188a98 100644
--- a/gdb/testsuite/gdb.dap/bt-nodebug.exp
+++ b/gdb/testsuite/gdb.dap/bt-nodebug.exp
@@ -71,6 +71,7 @@
# 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 4752347..5c709ed 100644
--- a/gdb/testsuite/gdb.dap/eof.exp
+++ b/gdb/testsuite/gdb.dap/eof.exp
@@ -30,8 +30,10 @@
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 3f0f75a..2d962e6 100644
--- a/gdb/testsuite/lib/dap-support.exp
+++ b/gdb/testsuite/lib/dap-support.exp
@@ -117,6 +117,7 @@
# 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 @@
}
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 @@
}
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 @@
global last_ton
set last_ton [ton::json2ton $json]
+ # tclint-disable-next-line command-args
return [namespace eval ton::2dict $last_ton]
}