From: Zachary T Welch Date: Mon, 23 Nov 2009 15:43:05 +0000 (-0800) Subject: armv4_5: use register_commands() X-Git-Tag: v0.4.0-rc1~355 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=84c03168a54549e2a102ceb25219ac8a2281d954;p=openocd armv4_5: use register_commands() --- diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index ec6d5a0e..dfb7094b 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -786,26 +786,42 @@ usage: return retval; } +static const struct command_registration arm_exec_command_handlers[] = { + { + .name = "reg", + .handler = &handle_armv4_5_reg_command, + .mode = COMMAND_EXEC, + .help = "display ARM core registers", + }, + { + .name = "core_state", + .handler = &handle_armv4_5_core_state_command, + .mode = COMMAND_EXEC, + .usage = "", + .help = "display/change ARM core state", + }, + { + .name = "disassemble", + .handler = &handle_armv4_5_disassemble_command, + .mode = COMMAND_EXEC, + .usage = "
[ ['thumb']]", + .help = "disassemble instructions ", + }, + COMMAND_REGISTRATION_DONE +}; +static const struct command_registration arm_command_handlers[] = { + { + .name = "arm", + .mode = COMMAND_ANY, + .help = "ARM command group", + .chain = arm_exec_command_handlers, + }, + COMMAND_REGISTRATION_DONE +}; + int armv4_5_register_commands(struct command_context *cmd_ctx) { - struct command *armv4_5_cmd; - - armv4_5_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm", - NULL, COMMAND_ANY, - "generic ARM commands"); - - COMMAND_REGISTER(cmd_ctx, armv4_5_cmd, "reg", - handle_armv4_5_reg_command, COMMAND_EXEC, - "display ARM core registers"); - COMMAND_REGISTER(cmd_ctx, armv4_5_cmd, "core_state", - handle_armv4_5_core_state_command, COMMAND_EXEC, - "display/change ARM core state "); - COMMAND_REGISTER(cmd_ctx, armv4_5_cmd, "disassemble", - handle_armv4_5_disassemble_command, COMMAND_EXEC, - "disassemble instructions " - "
[ ['thumb']]"); - - return ERROR_OK; + return register_commands(cmd_ctx, NULL, arm_command_handlers); } int armv4_5_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size)