aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/helper/command.c16
-rw-r--r--src/openocd.c5
-rw-r--r--src/target/target.c5
-rw-r--r--src/target/trace.c1
-rw-r--r--src/transport/transport.c3
5 files changed, 27 insertions, 3 deletions
diff --git a/src/helper/command.c b/src/helper/command.c
index 552031d..65e538b 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -323,6 +323,22 @@ static struct command *command_new(struct command_context *cmd_ctx,
{
assert(cr->name);
+ /*
+ If it is a non-jim command with no .usage specified,
+ log an error.
+
+ strlen(.usage) == 0 means that the command takes no
+ arguments.
+ */
+ if ((cr->jim_handler == NULL) &&
+ (cr->usage == NULL)) {
+ LOG_DEBUG("BUG: command '%s%s%s' does not have the "
+ "'.usage' field filled out",
+ parent && parent->name ? parent->name : "",
+ parent && parent->name ? " " : "",
+ cr->name);
+ }
+
struct command *c = calloc(1, sizeof(struct command));
if (NULL == c)
return NULL;
diff --git a/src/openocd.c b/src/openocd.c
index 3f0e142..60cbf23 100644
--- a/src/openocd.c
+++ b/src/openocd.c
@@ -195,6 +195,7 @@ static const struct command_registration openocd_command_handlers[] = {
.handler = &handle_noinit_command,
.mode = COMMAND_CONFIG,
.help = "Prevent 'init' from being called at startup.",
+ .usage = ""
},
{
.name = "init",
@@ -204,14 +205,14 @@ static const struct command_registration openocd_command_handlers[] = {
"Changes command mode from CONFIG to EXEC. "
"Unless 'noinit' is called, this command is "
"called automatically at the end of startup.",
-
+ .usage = ""
},
{
.name = "add_script_search_dir",
.handler = &handle_add_script_search_dir_command,
.mode = COMMAND_ANY,
.help = "dir to search for config files and scripts",
-
+ .usage = "<directory>"
},
COMMAND_REGISTRATION_DONE
};
diff --git a/src/target/target.c b/src/target/target.c
index 6b03466..7763685 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5534,11 +5534,13 @@ static const struct command_registration target_exec_command_handlers[] = {
.mode = COMMAND_EXEC,
.help = "loads active fast load image to current target "
"- mainly for profiling purposes",
+ .usage = "",
},
{
.name = "profile",
.handler = handle_profile_command,
.mode = COMMAND_EXEC,
+ .usage = "seconds filename",
.help = "profiling samples the CPU PC",
},
/** @todo don't register virt2phys() unless target supports it */
@@ -5599,6 +5601,7 @@ static const struct command_registration target_exec_command_handlers[] = {
.name = "soft_reset_halt",
.handler = handle_soft_reset_halt_command,
.mode = COMMAND_EXEC,
+ .usage = "",
.help = "halt the target and do a soft reset",
},
{
@@ -5655,7 +5658,7 @@ static const struct command_registration target_exec_command_handlers[] = {
.handler = handle_bp_command,
.mode = COMMAND_EXEC,
.help = "list or set hardware or software breakpoint",
- .usage = "usage: bp <address> [<asid>]<length> ['hw'|'hw_ctx']",
+ .usage = "<address> [<asid>]<length> ['hw'|'hw_ctx']",
},
{
.name = "rbp",
diff --git a/src/target/trace.c b/src/target/trace.c
index a8ec143..7604db8 100644
--- a/src/target/trace.c
+++ b/src/target/trace.c
@@ -179,6 +179,7 @@ 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
diff --git a/src/transport/transport.c b/src/transport/transport.c
index b5e4b90..3e67221 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -336,12 +336,14 @@ static const struct command_registration transport_commands[] = {
*/
.mode = COMMAND_ANY,
.help = "Initialize this session's transport",
+ .usage = ""
},
{
.name = "list",
.handler = handle_transport_list,
.mode = COMMAND_ANY,
.help = "list all built-in transports",
+ .usage = ""
},
{
.name = "select",
@@ -359,6 +361,7 @@ static const struct command_registration transport_group[] = {
.mode = COMMAND_ANY,
.help = "Transport command group",
.chain = transport_commands,
+ .usage = ""
},
COMMAND_REGISTRATION_DONE
};