mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
monitor: allow register hmp commands
Allow commands having a NULL cmd pointer, add a function to set the pointer later. Use case: allow modules implement hmp commands. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jose R. Ziviani <jziviani@suse.de> Message-Id: <20210624103836.2382472-31-kraxel@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
dae0ec159f
commit
f0e48cbd79
3 changed files with 26 additions and 0 deletions
|
@ -1089,6 +1089,13 @@ void handle_hmp_command(MonitorHMP *mon, const char *cmdline)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!cmd->cmd) {
|
||||
/* FIXME: is it useful to try autoload modules here ??? */
|
||||
monitor_printf(&mon->common, "Command \"%.*s\" is not available.\n",
|
||||
(int)(cmdline - cmd_start), cmd_start);
|
||||
return;
|
||||
}
|
||||
|
||||
qdict = monitor_parse_arguments(&mon->common, &cmdline, cmd);
|
||||
if (!qdict) {
|
||||
while (cmdline > cmd_start && qemu_isspace(cmdline[-1])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue