This is an automated email from Gerrit. "Daniel Anselmi <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9356
-- gerrit commit a85b80f20d04189c78e970d20d5c50613d40fbed Author: Daniel Anselmi <[email protected]> Date: Sun Dec 28 22:04:23 2025 +0100 ipdbg: add commands to list hubs an services Adding commands to list created hubs and active connections on hubs. This is useful to debug configuration problems. Change-Id: Ifb8bea7e64e172f15cd861e86edf3412ae232352 Signed-off-by: Daniel Anselmi <[email protected]> diff --git a/src/server/ipdbg.c b/src/server/ipdbg.c index 466717c468..995d10f4d5 100644 --- a/src/server/ipdbg.c +++ b/src/server/ipdbg.c @@ -925,6 +925,27 @@ COMMAND_HANDLER(handle_ipdbg_cfg_queuing_command) return CALL_COMMAND_HANDLER(ipdbg_config_queuing, hub, size); } +COMMAND_HANDLER(handle_ipdbg_hub_list_services_command) +{ + struct ipdbg_service *service; + struct ipdbg_hub *hub = CMD_DATA; + int i = 0; + + for (service = ipdbg_first_service; service; service = service->next) { + if (hub == service->hub) { + if (service->connection.closed) + command_print(CMD, "#%i: using port %u, listening", i++, service->port); + else + command_print(CMD, "#%i: using port %u, conneced", i++, service->port); + } + } + + if (i == 0) + command_print(CMD, "no services were started"); + + return ERROR_OK; +} + static const struct command_registration ipdbg_hub_subcommand_handlers[] = { { .name = "start", @@ -942,8 +963,13 @@ static const struct command_registration ipdbg_hub_subcommand_handlers[] = { .name = "queuing", .handler = handle_ipdbg_cfg_queuing_command, .mode = COMMAND_ANY, - .help = "configures queuing between IPDBG Host and Hub.", + .help = "Configures queuing between IPDBG Host and Hub.", .usage = "-size size", + }, { + .name = "list-services", + .handler = handle_ipdbg_hub_list_services_command, + .mode = COMMAND_ANY, + .help = "List services of IPDBG Hub.", }, COMMAND_REGISTRATION_DONE }; @@ -1117,6 +1143,47 @@ COMMAND_HANDLER(handle_ipdbg_create_hub_command) return ipdbg_create_hub(tap, user_instruction, data_register_length, virtual_ir, hub_name, cmd); } +COMMAND_HANDLER(handle_ipdbg_list_hubs_command) +{ + struct ipdbg_hub *hub; + int i; + + if (!ipdbg_first_hub) { + command_print(CMD, "no hubs created"); + return ERROR_OK; + } + + i = 0; + for (hub = ipdbg_first_hub; hub; hub = hub->next) + command_print(CMD, "#%i: %s", i++, hub->name); + + return ERROR_OK; +} + +COMMAND_HANDLER(handle_ipdbg_list_services_command) +{ + struct ipdbg_service *service; + int i; + + if (!ipdbg_first_service) { + command_print(CMD, "no services were started"); + return ERROR_OK; + } + + i = 0; + for (service = ipdbg_first_service; service; service = service->next) { + struct ipdbg_hub *hub = service->hub; + if (hub) { + if (service->connection.closed) + command_print(CMD, "#%i: listening port %u for hub '%s'", i++, service->port, hub->name); + else + command_print(CMD, "#%i: using port %u for hub '%s'", i++, service->port, hub->name); + } + } + + return ERROR_OK; +} + static const struct command_registration ipdbg_config_command_handlers[] = { { .name = "create-hub", @@ -1125,6 +1192,16 @@ static const struct command_registration ipdbg_config_command_handlers[] = { .help = "create a IPDBG Hub", .usage = "name.ipdbghub (-tap device.tap -ir ir_value [dr_length] |" " -pld name.pld [user]) [-vir [vir_value [length [instr_code]]]]", + }, { + .name = "list-hubs", + .mode = COMMAND_ANY, + .handler = handle_ipdbg_list_hubs_command, + .help = "list all created IPDBG Hubs", + }, { + .name = "list-services", + .mode = COMMAND_ANY, + .handler = handle_ipdbg_list_services_command, + .help = "list all services", }, COMMAND_REGISTRATION_DONE }; @@ -1139,6 +1216,7 @@ 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); --
