This is an automated email from Gerrit.

"zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can 
find at https://review.openocd.org/c/openocd/+/8344

-- gerrit

commit 13299c895bf5dea1594fc3ddc0062ce9abcba723
Author: Marc Schink <d...@zapb.de>
Date:   Mon Jun 17 09:12:34 2024 +0200

    server/tcl: Restructure commands
    
    Use a command group 'tcl' with subcommands instead of individual
    commands with 'tcl_' prefix.
    
    The old commands are still available to ensure backwards compatibility,
    but are marked as deprecated.
    
    Change-Id: I1efd8a0e2c1403833f8cb656510a54d5ab0b2740
    Signed-off-by: Marc Schink <d...@zapb.de>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 306784e512..bae0b79e4a 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2219,7 +2219,7 @@ gdb (with 'set remotetimeout') is recommended. An 
insufficient timeout may
 cause initialization to fail with "Unknown remote qXfer reply: OK".
 @end deffn
 
-@deffn {Config Command} {tcl_port} [number]
+@deffn {Config Command} {tcl port} [number]
 Specify or query the port used for a simplified RPC
 connection that can be used by clients to issue TCL commands and get the
 output from the Tcl engine.
@@ -10559,7 +10559,7 @@ the destination of the trace data:
 @item @option{external} -- configure TPIU/SWO to let user capture trace
 output externally, either with an additional UART or with a logic analyzer 
(default);
 @item @option{-} -- configure TPIU/SWO and debug adapter to gather trace data
-and forward it to @command{tcl_trace} command;
+and forward it to @command{tcl trace} command;
 @item @option{:}@var{port} -- configure TPIU/SWO and debug adapter to gather
 trace data, open a TCP server at port @var{port} and send the trace data to
 each connected client;
@@ -12747,7 +12747,7 @@ OpenOCD provides a simple RPC server that allows to run 
arbitrary Tcl
 commands and receive the results.
 
 To access it, your application needs to connect to a configured TCP port
-(see @command{tcl_port}). Then it can pass any string to the
+(see @command{tcl port}). Then it can pass any string to the
 interpreter terminating it with @code{0x1a} and wait for the return
 value (it will be terminated with @code{0x1a} as well). This can be
 repeated as many times as desired without reopening the connection.
@@ -12773,7 +12773,7 @@ type target_state state [state-name]
 type target_reset mode [reset-mode]
 @end verbatim
 
-@deffn {Command} {tcl_notifications} [on/off]
+@deffn {Command} {tcl notifications} [on/off]
 Toggle output of target notifications to the current Tcl RPC server.
 Only available from the Tcl RPC server.
 Defaults to off.
@@ -12792,7 +12792,7 @@ Target trace data is emitted as a Tcl associative array 
in the following format.
 type target_trace data [trace-data-hex-encoded]
 @end verbatim
 
-@deffn {Command} {tcl_trace} [on/off]
+@deffn {Command} {tcl trace} [on/off]
 Toggle output of target trace data to the current Tcl RPC server.
 Only available from the Tcl RPC server.
 Defaults to off.
diff --git a/src/server/startup.tcl b/src/server/startup.tcl
index 93f718927d..ebfb0562e9 100644
--- a/src/server/startup.tcl
+++ b/src/server/startup.tcl
@@ -95,3 +95,21 @@ proc "gdb_save_tdesc" {} {
        echo "DEPRECATED! use 'gdb save_tdesc', not 'gdb_save_tdesc'"
        eval gdb save_tdesc
 }
+
+lappend _telnet_autocomplete_skip "tcl_port"
+proc "tcl_port" {args} {
+       echo "DEPRECATED! use 'tcl port' not 'tcl_port'"
+       eval tcl port $args
+}
+
+lappend _telnet_autocomplete_skip "tcl_notifications"
+proc "tcl_notifications" {state} {
+       echo "DEPRECATED! use 'tcl notifications' not 'tcl_notifications'"
+       eval tcl notifications $state
+}
+
+lappend _telnet_autocomplete_skip "tcl_trace"
+proc "tcl_trace" {state} {
+       echo "DEPRECATED! use 'tcl trace' not 'tcl_trace'"
+       eval tcl trace $state
+}
diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c
index 16cbedc76c..aec39ff819 100644
--- a/src/server/tcl_server.c
+++ b/src/server/tcl_server.c
@@ -323,9 +323,9 @@ COMMAND_HANDLER(handle_tcl_trace_command)
        }
 }
 
-static const struct command_registration tcl_command_handlers[] = {
+static const struct command_registration tcl_subcommand_handlers[] = {
        {
-               .name = "tcl_port",
+               .name = "port",
                .handler = handle_tcl_port_command,
                .mode = COMMAND_CONFIG,
                .help = "Specify port on which to listen "
@@ -334,14 +334,14 @@ static const struct command_registration 
tcl_command_handlers[] = {
                .usage = "[port_num]",
        },
        {
-               .name = "tcl_notifications",
+               .name = "notifications",
                .handler = handle_tcl_notifications_command,
                .mode = COMMAND_EXEC,
                .help = "Target Notification output",
                .usage = "[on|off]",
        },
        {
-               .name = "tcl_trace",
+               .name = "trace",
                .handler = handle_tcl_trace_command,
                .mode = COMMAND_EXEC,
                .help = "Target trace output",
@@ -350,6 +350,17 @@ static const struct command_registration 
tcl_command_handlers[] = {
        COMMAND_REGISTRATION_DONE
 };
 
+static const struct command_registration tcl_command_handlers[] = {
+       {
+               .name = "tcl",
+               .mode = COMMAND_ANY,
+               .help = "tcl command group",
+               .usage = "",
+               .chain = tcl_subcommand_handlers,
+       },
+       COMMAND_REGISTRATION_DONE
+};
+
 int tcl_register_commands(struct command_context *cmd_ctx)
 {
        tcl_port = strdup("6666");

-- 

Reply via email to