[binutils-gdb] [gdb/testsuite, Tcl 9.0] Fix use of deprecated trace variable subcommand

Tom de Vries via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ef7727ae62774ae4298008937e133c614b8eeaec

commit ef7727ae62774ae4298008937e133c614b8eeaec
Author: Tom de Vries <[email protected]>
Date:   Fri Mar 20 10:13:27 2026 +0100

    [gdb/testsuite, Tcl 9.0] Fix use of deprecated trace variable subcommand
    
    With Tcl 9.0, we get:
    ...
    bad option "variable": must be add, info, or remove
        while executing
    "trace variable "boards_dir" w append_gdb_boards_dir"
        (file "lib/append_gdb_boards_dir.exp" line 48)
    ...
    
    The trace subcommand "trace variable <name> <ops> <command>" [1]:
    - is equivalent to "trace add variable <name> <ops> <command>"
    - is for backwards compatibility,
    - uses "an older syntax in which array, read, write, unset are replaced by a,
      r, w and u respectively",
    - has an ops argument which is "not a list, but simply a string concatenation
      of the operations", and
    - is "deprecated and will likely be removed in a future version of Tcl".
    
    Fix this by using "trace add variable":
    ...
    -trace variable "boards_dir" w append_gdb_boards_dir
    +trace add variable "boards_dir" {write} append_gdb_boards_dir
    ...
    
    Approved-By: Tom Tromey <[email protected]>
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33948
    
    [1] https://www.tcl-lang.org/man/tcl8.6/TclCmd/trace.htm#M27

Diff:
---
 gdb/testsuite/lib/append_gdb_boards_dir.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/append_gdb_boards_dir.exp b/gdb/testsuite/lib/append_gdb_boards_dir.exp
index fb756409065..8984744ab86 100644
--- a/gdb/testsuite/lib/append_gdb_boards_dir.exp
+++ b/gdb/testsuite/lib/append_gdb_boards_dir.exp
@@ -45,4 +45,4 @@ proc append_gdb_boards_dir { name1 name2 op } {
     }
     lappend boards_dir "${gdb_boards_dir}"
 }
-trace variable "boards_dir" w append_gdb_boards_dir
+trace add variable "boards_dir" {write} append_gdb_boards_dir
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.