diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 3ed2b1fc4..284def3ca 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2249,7 +2249,7 @@ int gdb_init(void) return ERROR_OK; } -int handle_gdb_sync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_sync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc != 0) { @@ -2269,12 +2269,12 @@ int handle_gdb_sync_command(struct command_context_s *cmd_ctx, char *cmd, char * } /* daemon configuration command gdb_port */ -int handle_gdb_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { return server_port_command(cmd_ctx, cmd, args, argc, &gdb_port); } -int handle_gdb_memory_map_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_memory_map_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc == 1) { @@ -2295,7 +2295,7 @@ int handle_gdb_memory_map_command(struct command_context_s *cmd_ctx, char *cmd, return ERROR_COMMAND_SYNTAX_ERROR; } -int handle_gdb_flash_program_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_flash_program_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc == 1) { @@ -2316,7 +2316,7 @@ int handle_gdb_flash_program_command(struct command_context_s *cmd_ctx, char *cm return ERROR_COMMAND_SYNTAX_ERROR; } -int handle_gdb_report_data_abort_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_report_data_abort_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc == 1) { @@ -2338,7 +2338,7 @@ int handle_gdb_report_data_abort_command(struct command_context_s *cmd_ctx, char } /* gdb_breakpoint_override */ -int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc == 0) { @@ -2373,17 +2373,25 @@ int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, ch int gdb_register_commands(command_context_t *command_context) { - register_command(command_context, NULL, "gdb_sync", handle_gdb_sync_command, - COMMAND_ANY, "next stepi will return immediately allowing GDB fetch register state without affecting target state"); - register_command(command_context, NULL, "gdb_port", handle_gdb_port_command, - COMMAND_ANY, "daemon configuration command gdb_port"); - register_command(command_context, NULL, "gdb_memory_map", handle_gdb_memory_map_command, - COMMAND_CONFIG, "enable or disable memory map"); - register_command(command_context, NULL, "gdb_flash_program", handle_gdb_flash_program_command, - COMMAND_CONFIG, "enable or disable flash program"); - register_command(command_context, NULL, "gdb_report_data_abort", handle_gdb_report_data_abort_command, - COMMAND_CONFIG, "enable or disable reporting data aborts"); - register_command(command_context, NULL, "gdb_breakpoint_override", handle_gdb_breakpoint_override_command, - COMMAND_EXEC, "hard/soft/disable - force breakpoint type for gdb 'break' commands."); + register_command(command_context, NULL, "gdb_sync", + handle_gdb_sync_command, COMMAND_ANY, + "next stepi will return immediately allowing GDB to " + "fetch register state without affecting target state"); + register_command(command_context, NULL, "gdb_port", + handle_gdb_port_command, COMMAND_ANY, + "daemon configuration command gdb_port"); + register_command(command_context, NULL, "gdb_memory_map", + handle_gdb_memory_map_command, COMMAND_CONFIG, + "enable or disable memory map"); + register_command(command_context, NULL, "gdb_flash_program", + handle_gdb_flash_program_command, COMMAND_CONFIG, + "enable or disable flash program"); + register_command(command_context, NULL, "gdb_report_data_abort", + handle_gdb_report_data_abort_command, COMMAND_CONFIG, + "enable or disable reporting data aborts"); + register_command(command_context, NULL, "gdb_breakpoint_override", + handle_gdb_breakpoint_override_command, COMMAND_EXEC, + "hard/soft/disable - force type of breakpoint " + "used by gdb 'break' commands."); return ERROR_OK; } diff --git a/src/server/server.c b/src/server/server.c index 03f0ee6ec..05018694b 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -41,7 +41,6 @@ service_t *services = NULL; /* shutdown_openocd == 1: exit the main event loop, and quit the debugger */ static int shutdown_openocd = 0; -int handle_shutdown_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); /* set when using pipes rather than tcp */ int server_use_pipes = 0; @@ -534,22 +533,25 @@ int server_quit(void) return ERROR_OK; } -int server_register_commands(command_context_t *context) -{ - register_command(context, NULL, "shutdown", handle_shutdown_command, - COMMAND_ANY, "shut the server down"); - - return ERROR_OK; -} - /* tell the server we want to shut down */ -int handle_shutdown_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_shutdown_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { shutdown_openocd = 1; return ERROR_COMMAND_CLOSE_CONNECTION; } +int server_register_commands(command_context_t *context) +{ + register_command(context, NULL, "shutdown", + handle_shutdown_command, COMMAND_ANY, + "shut the server down"); + + return ERROR_OK; +} + + int server_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, unsigned short *out) { diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c index 178d86ba8..2e93e3613 100644 --- a/src/server/tcl_server.c +++ b/src/server/tcl_server.c @@ -36,9 +36,6 @@ typedef struct tcl_connection_s { static unsigned short tcl_port = 6666; -/* commands */ -static int handle_tcl_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - /* handlers */ static int tcl_new_connection(connection_t *connection); static int tcl_input(connection_t *connection); @@ -173,14 +170,16 @@ int tcl_init(void) return retval; } -int tcl_register_commands(command_context_t *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "tcl_port", handle_tcl_port_command, COMMAND_CONFIG, "port on which to listen for incoming TCL syntax"); - return ERROR_OK; -} - static int handle_tcl_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { return server_port_command(cmd_ctx, cmd, args, argc, &tcl_port); } + +int tcl_register_commands(command_context_t *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "tcl_port", + handle_tcl_port_command, COMMAND_CONFIG, + "port on which to listen for incoming TCL syntax"); + return ERROR_OK; +} diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index c9c60bbda..84959e3a0 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -32,9 +32,6 @@ static unsigned short telnet_port = 4444; -int handle_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_telnet_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - static char *negotiate = "\xFF\xFB\x03" /* IAC WILL Suppress Go Ahead */ "\xFF\xFB\x01" /* IAC WILL Echo */ @@ -608,24 +605,30 @@ int telnet_init(char *banner) return ERROR_OK; } -int telnet_register_commands(command_context_t *command_context) -{ - register_command(command_context, NULL, "exit", handle_exit_command, - COMMAND_EXEC, "exit telnet session"); - - register_command(command_context, NULL, "telnet_port", handle_telnet_port_command, - COMMAND_ANY, "port on which to listen for incoming telnet connections"); - - return ERROR_OK; -} - /* daemon configuration command telnet_port */ -int handle_telnet_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_telnet_port_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { return server_port_command(cmd_ctx, cmd, args, argc, &telnet_port); } -int handle_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_exit_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { return ERROR_COMMAND_CLOSE_CONNECTION; } + +int telnet_register_commands(command_context_t *command_context) +{ + register_command(command_context, NULL, "exit", + &handle_exit_command, COMMAND_EXEC, + "exit telnet session"); + + register_command(command_context, NULL, "telnet_port", + &handle_telnet_port_command, COMMAND_ANY, + "port on which to listen for incoming telnet connections"); + + return ERROR_OK; +} + +