Added hmp interface. Signed-off-by: Sanidhya Kashyap <sanidhya.ii...@gmail.com> --- hmp-commands.hx | 15 +++++++++++++++ hmp.c | 14 ++++++++++++++ hmp.h | 1 + 3 files changed, 30 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx index d0943b1..c492f3f 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1788,6 +1788,21 @@ STEXI show available trace events and their state ETEXI + { + .name = "test-vmstates", + .args_type = "times:i?,sinterval:i?", + .params = "times sinterval", + .help = "test the vmstates by dumping and loading form memory\n\t\t\t" + "times: number of times, the vmstates will be tested\n\t\t\t" + "sinterval: sleep interval in milliseconds between each iteration", + .mhandler.cmd = hmp_test_vmstates, + }, +STEXI +@item test-vmstates +@findex test-vmstates +dumps and reads the device state's data from the memory for testing purpose +ETEXI + STEXI @end table ETEXI diff --git a/hmp.c b/hmp.c index 4d1838e..38ec5b3 100644 --- a/hmp.c +++ b/hmp.c @@ -1714,3 +1714,17 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict) monitor_printf(mon, "\n"); } + +void hmp_test_vmstates(Monitor *mon, const QDict *qdict) +{ + int64_t times = qdict_get_try_int(qdict, "times", 10); + int64_t sleep_interval = qdict_get_try_int(qdict, "sinterval", 100); + Error *err = NULL; + + qmp_test_vmstates(!!times, times, !!sleep_interval, sleep_interval, &err); + + if (err) { + monitor_printf(mon, "test-vmstates: %s\n", error_get_pretty(err)); + error_free(err); + } +} diff --git a/hmp.h b/hmp.h index 4fd3c4a..9f00997 100644 --- a/hmp.h +++ b/hmp.h @@ -94,6 +94,7 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict); void hmp_object_add(Monitor *mon, const QDict *qdict); void hmp_object_del(Monitor *mon, const QDict *qdict); void hmp_info_memdev(Monitor *mon, const QDict *qdict); +void hmp_test_vmstates(Monitor *mon, const QDict *qdict); void object_add_completion(ReadLineState *rs, int nb_args, const char *str); void object_del_completion(ReadLineState *rs, int nb_args, const char *str); void device_add_completion(ReadLineState *rs, int nb_args, const char *str); -- 1.9.3