ipdbg: simplify command chains

simplify ipdbg commands:
$hub_name ipdbg start -> $hub_name start

ipdbg/fix: While there, handle the multi-word deprecated commands
by adding quotes.

Change-Id: I5a56df2dbf2a5710442242727fa9384e5541ed53
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Fixes: https://sourceforge.net/p/openocd/tickets/434/
Reported-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8873
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Daniel Anselmi
2024-12-28 02:22:51 +01:00
committed by Antonio Borneo
parent 1afb3e75f0
commit 52ea420dd2
8 changed files with 29 additions and 41 deletions

View File

@@ -1205,7 +1205,7 @@ proc "pld device" {driver tap_name {opt 0}} {
lappend _telnet_autocomplete_skip "ipdbg -start"
proc "ipdbg -start" {args} {
echo "DEPRECATED! use 'ipdbg create-hub' and 'chip.ipdbghub ipdbg start ...', not 'ipdbg -start ...'"
echo "DEPRECATED! use 'ipdbg create-hub' and 'chip.ipdbghub start ...', not 'ipdbg -start ...'"
set tap_name ""
set pld_name ""
set tool_num "1"
@@ -1271,17 +1271,14 @@ proc "ipdbg -start" {args} {
return
}
echo "name: $hub_name"
echo "ipdbg create-hub $hub_name $args"
catch {eval ipdbg create-hub $hub_name $args}
eval $hub_name ipdbg start -tool $tool_num -port $port_num
eval $hub_name start -tool $tool_num -port $port_num
}
lappend _telnet_autocomplete_skip "ipdbg -stop"
proc "ipdbg -stop" {args} {
echo "DEPRECATED! use 'chip.ipdbghub ipdbg stop ...', not 'ipdbg -stop ...'"
echo "DEPRECATED! use 'chip.ipdbghub stop ...', not 'ipdbg -stop ...'"
set tap_name ""
set pld_name ""
set tool_num "1"
@@ -1328,7 +1325,11 @@ proc "ipdbg -stop" {args} {
return
}
eval $hub_name ipdbg stop -tool $tool_num
eval $hub_name stop -tool $tool_num
}
proc ipdbg {cmd args} {
tailcall "ipdbg $cmd" {*}$args
}
# END MIGRATION AIDS

View File

@@ -885,23 +885,6 @@ COMMAND_HANDLER(handle_ipdbg_stop_command)
return ipdbg_stop(hub, tool);
}
static const struct command_registration ipdbg_hostserver_subcommand_handlers[] = {
{
.name = "start",
.mode = COMMAND_EXEC,
.handler = handle_ipdbg_start_command,
.help = "Starts a IPDBG Host server.",
.usage = "-tool number -port port"
}, {
.name = "stop",
.mode = COMMAND_EXEC,
.handler = handle_ipdbg_stop_command,
.help = "Stops a IPDBG Host server.",
.usage = "-tool number"
},
COMMAND_REGISTRATION_DONE
};
static COMMAND_HELPER(ipdbg_config_queuing, struct ipdbg_hub *hub, unsigned int size)
{
if (!hub)
@@ -944,13 +927,18 @@ COMMAND_HANDLER(handle_ipdbg_cfg_queuing_command)
static const struct command_registration ipdbg_hub_subcommand_handlers[] = {
{
.name = "ipdbg",
.name = "start",
.mode = COMMAND_EXEC,
.help = "IPDBG Hub commands.",
.usage = "",
.chain = ipdbg_hostserver_subcommand_handlers
},
{
.handler = handle_ipdbg_start_command,
.help = "Starts a IPDBG Host server.",
.usage = "-tool number -port port"
}, {
.name = "stop",
.mode = COMMAND_EXEC,
.handler = handle_ipdbg_stop_command,
.help = "Stops a IPDBG Host server.",
.usage = "-tool number"
}, {
.name = "queuing",
.handler = handle_ipdbg_cfg_queuing_command,
.mode = COMMAND_ANY,
@@ -1151,7 +1139,6 @@ static const struct command_registration ipdbg_command_handlers[] = {
},
COMMAND_REGISTRATION_DONE
};
int ipdbg_register_commands(struct command_context *cmd_ctx)
{
return register_commands(cmd_ctx, NULL, ipdbg_command_handlers);