X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Ftrace.c;h=7604db8b49908bd80a9e7365247035d3d323d3f4;hp=c038a1521a558fb6c66a01e052a80b754efecc86;hb=3a550e5b5fe011e526b150a5d234b48e8e2aaad6;hpb=2861877b32a7a2f4022a1c3d9b66c9b4879878ac diff --git a/src/target/trace.c b/src/target/trace.c index c038a1521a..7604db8b49 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -21,7 +21,7 @@ #include "config.h" #endif -#include "log.h" +#include #include "trace.h" #include "target.h" @@ -156,16 +156,36 @@ 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_EXEC, + .help = "trace command group", + .usage = "", + .chain = trace_exec_command_handlers, + }, + COMMAND_REGISTRATION_DONE +}; + int trace_register_commands(struct command_context *cmd_ctx) { - struct command *trace_cmd = - register_command(cmd_ctx, NULL, "trace", NULL, COMMAND_ANY, "trace commands"); - - register_command(cmd_ctx, trace_cmd, "history", handle_trace_history_command, - COMMAND_EXEC, "display trace history, ['clear'] history or set [size]"); - - register_command(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); }