提交 250b8197 编写于 作者: D Dr. David Alan Gilbert

hmp: Fix unknown command for subtable

(qemu) info foo
unknown command: 'foo'

fix this to:
(qemu) info foo
unknown command: 'info foo'
Reported-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20170817104216.29150-3-dgilbert@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
上级 40c71f63
...@@ -2697,6 +2697,7 @@ static const mon_cmd_t *search_dispatch_table(const mon_cmd_t *disp_table, ...@@ -2697,6 +2697,7 @@ static const mon_cmd_t *search_dispatch_table(const mon_cmd_t *disp_table,
* the command is found in a sub-command table. * the command is found in a sub-command table.
*/ */
static const mon_cmd_t *monitor_parse_command(Monitor *mon, static const mon_cmd_t *monitor_parse_command(Monitor *mon,
const char *cmdp_start,
const char **cmdp, const char **cmdp,
mon_cmd_t *table) mon_cmd_t *table)
{ {
...@@ -2712,7 +2713,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon, ...@@ -2712,7 +2713,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
cmd = search_dispatch_table(table, cmdname); cmd = search_dispatch_table(table, cmdname);
if (!cmd) { if (!cmd) {
monitor_printf(mon, "unknown command: '%.*s'\n", monitor_printf(mon, "unknown command: '%.*s'\n",
(int)(p - *cmdp), *cmdp); (int)(p - cmdp_start), cmdp_start);
return NULL; return NULL;
} }
...@@ -2724,7 +2725,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon, ...@@ -2724,7 +2725,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
*cmdp = p; *cmdp = p;
/* search sub command */ /* search sub command */
if (cmd->sub_table != NULL && *p != '\0') { if (cmd->sub_table != NULL && *p != '\0') {
return monitor_parse_command(mon, cmdp, cmd->sub_table); return monitor_parse_command(mon, cmdp_start, cmdp, cmd->sub_table);
} }
return cmd; return cmd;
...@@ -3108,7 +3109,7 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline) ...@@ -3108,7 +3109,7 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
trace_handle_hmp_command(mon, cmdline); trace_handle_hmp_command(mon, cmdline);
cmd = monitor_parse_command(mon, &cmdline, mon->cmd_table); cmd = monitor_parse_command(mon, cmdline, &cmdline, mon->cmd_table);
if (!cmd) { if (!cmd) {
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册