Revision 0268d97c
b/monitor.c | ||
---|---|---|
491 | 491 |
return 0; |
492 | 492 |
} |
493 | 493 |
|
494 |
static int mon_set_cpu(int cpu_index); |
|
495 |
static void handle_user_command(Monitor *mon, const char *cmdline); |
|
496 |
|
|
497 |
static int do_hmp_passthrough(Monitor *mon, const QDict *params, |
|
498 |
QObject **ret_data) |
|
499 |
{ |
|
500 |
int ret = 0; |
|
501 |
Monitor *old_mon, hmp; |
|
502 |
CharDriverState mchar; |
|
503 |
|
|
504 |
memset(&hmp, 0, sizeof(hmp)); |
|
505 |
qemu_chr_init_mem(&mchar); |
|
506 |
hmp.chr = &mchar; |
|
507 |
|
|
508 |
old_mon = cur_mon; |
|
509 |
cur_mon = &hmp; |
|
510 |
|
|
511 |
if (qdict_haskey(params, "cpu-index")) { |
|
512 |
ret = mon_set_cpu(qdict_get_int(params, "cpu-index")); |
|
513 |
if (ret < 0) { |
|
514 |
cur_mon = old_mon; |
|
515 |
qerror_report(QERR_INVALID_PARAMETER_VALUE, "cpu-index", "a CPU number"); |
|
516 |
goto out; |
|
517 |
} |
|
518 |
} |
|
519 |
|
|
520 |
handle_user_command(&hmp, qdict_get_str(params, "command-line")); |
|
521 |
cur_mon = old_mon; |
|
522 |
|
|
523 |
if (qemu_chr_mem_osize(hmp.chr) > 0) { |
|
524 |
*ret_data = QOBJECT(qemu_chr_mem_to_qs(hmp.chr)); |
|
525 |
} |
|
526 |
|
|
527 |
out: |
|
528 |
qemu_chr_close_mem(hmp.chr); |
|
529 |
return ret; |
|
530 |
} |
|
531 |
|
|
494 | 532 |
static int compare_cmd(const char *name, const char *list) |
495 | 533 |
{ |
496 | 534 |
const char *p, *pstart; |
b/qmp-commands.hx | ||
---|---|---|
761 | 761 |
|
762 | 762 |
Note: This command must be issued before issuing any other command. |
763 | 763 |
|
764 |
EQMP |
|
765 |
|
|
766 |
{ |
|
767 |
.name = "human-monitor-command", |
|
768 |
.args_type = "command-line:s,cpu-index:i?", |
|
769 |
.params = "", |
|
770 |
.help = "", |
|
771 |
.user_print = monitor_user_noop, |
|
772 |
.mhandler.cmd_new = do_hmp_passthrough, |
|
773 |
}, |
|
774 |
|
|
775 |
SQMP |
|
776 |
human-monitor-command |
|
777 |
--------------------- |
|
778 |
|
|
779 |
Execute a Human Monitor command. |
|
780 |
|
|
781 |
Arguments: |
|
782 |
|
|
783 |
- command-line: the command name and its arguments, just like the |
|
784 |
Human Monitor's shell (json-string) |
|
785 |
- cpu-index: select the CPU number to be used by commands which access CPU |
|
786 |
data, like 'info registers'. The Monitor selects CPU 0 if this |
|
787 |
argument is not provided (json-int, optional) |
|
788 |
|
|
789 |
Example: |
|
790 |
|
|
791 |
-> { "execute": "human-monitor-command", "arguments": { "command-line": "info kvm" } } |
|
792 |
<- { "return": "kvm support: enabled\r\n" } |
|
793 |
|
|
794 |
Notes: |
|
795 |
|
|
796 |
(1) The Human Monitor is NOT an stable interface, this means that command |
|
797 |
names, arguments and responses can change or be removed at ANY time. |
|
798 |
Applications that rely on long term stability guarantees should NOT |
|
799 |
use this command |
|
800 |
|
|
801 |
(2) Limitations: |
|
802 |
|
|
803 |
o This command is stateless, this means that commands that depend |
|
804 |
on state information (such as getfd) might not work |
|
805 |
|
|
806 |
o Commands that prompt the user for data (eg. 'cont' when the block |
|
807 |
device is encrypted) don't currently work |
|
808 |
|
|
764 | 809 |
3. Query Commands |
765 | 810 |
================= |
766 | 811 |
|
Also available in: Unified diff