]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite, tclint] Fix gdb.dap
authorTom de Vries <tdevries@suse.de>
Wed, 17 Sep 2025 17:07:43 +0000 (19:07 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 17 Sep 2025 17:07:43 +0000 (19:07 +0200)
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

gdb/testsuite/gdb.dap/bt-nodebug.exp
gdb/testsuite/gdb.dap/eof.exp
gdb/testsuite/lib/dap-support.exp

index 3053f8c446f79a500d2aa5d6331945bc10dc7f71..8188a983734219588fe74c65f63a0f97c65e6fc0 100644 (file)
@@ -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
index 4752347c1572a108645fb67c16b506ff1ac0dd9a..5c709ed0d8bab3615e7a08fe378d1631aaf6be2a 100644 (file)
@@ -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
index 3f0f75ab0ba151187fe40d1e0106373a412f763e..2d962e6dd093c51b7d0b6a6b2efb6838bbd3f988 100644 (file)
@@ -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]
 }