summaryrefslogtreecommitdiff
path: root/src/target/trace.c
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-23 07:43:06 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-24 21:37:36 -0800
commit8a41656391bd8eb6854c8573920d1155d815966b (patch)
tree4ca7cc6d71cdc562c63a8665af4a65993a1e7082 /src/target/trace.c
parent5f6962b34f623e7daf0dfb1f6249620431b5ab79 (diff)
downloadopenocd+libswd-8a41656391bd8eb6854c8573920d1155d815966b.tar.gz
openocd+libswd-8a41656391bd8eb6854c8573920d1155d815966b.tar.bz2
openocd+libswd-8a41656391bd8eb6854c8573920d1155d815966b.tar.xz
openocd+libswd-8a41656391bd8eb6854c8573920d1155d815966b.zip
trace: use register_commands()
Diffstat (limited to 'src/target/trace.c')
-rw-r--r--src/target/trace.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/target/trace.c b/src/target/trace.c
index c3897a07..f257592b 100644
--- a/src/target/trace.c
+++ b/src/target/trace.c
@@ -156,16 +156,35 @@ COMMAND_HANDLER(handle_trace_history_command)
return ERROR_OK;
}
+static const struct command_registration trace_exec_command_handlers[] = {
+ {
+ .name = "history",
+ .handler = &handle_trace_history_command,
+ .mode = COMMAND_EXEC,
+ .help = "display trace history, clear history or set [size]",
+ .usage = "[clear|<size>]",
+ },
+ {
+ .name = "point",
+ .handler = &handle_trace_point_command,
+ .mode = COMMAND_EXEC,
+ .help = "display trace points, clear list of trace points, "
+ "or add new tracepoint at [address]",
+ .usage = "[clear|<address>]",
+ },
+ COMMAND_REGISTRATION_DONE
+};
+static const struct command_registration trace_command_handlers[] = {
+ {
+ .name = "trace",
+ .mode = COMMAND_ANY,
+ .help = "trace command group",
+ .chain = trace_exec_command_handlers,
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
int trace_register_commands(struct command_context *cmd_ctx)
{
- struct command *trace_cmd =
- COMMAND_REGISTER(cmd_ctx, NULL, "trace", NULL, COMMAND_ANY, "trace commands");
-
- COMMAND_REGISTER(cmd_ctx, trace_cmd, "history", handle_trace_history_command,
- COMMAND_EXEC, "display trace history, ['clear'] history or set [size]");
-
- COMMAND_REGISTER(cmd_ctx, trace_cmd, "point", handle_trace_point_command,
- COMMAND_EXEC, "display trace points, ['clear'] list of trace points, or add new tracepoint at [address]");
-
- return ERROR_OK;
+ return register_commands(cmd_ctx, NULL, trace_command_handlers);
}