@@ -1678,16 +1678,36 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict)
}
#endif
-static void do_info_status(Monitor *mon)
+static void do_info_status_print(Monitor *mon, const QObject *data)
{
+ monitor_printf(mon, "VM status: %s\n",
+ qstring_get_str(qobject_to_qstring(data)));
+}
+
+/**
+ * do_info_status(): VM status
+ *
+ * Return a QString with status information, which can be:
+ *
+ * - "running"
+ * - "running (single step mode)"
+ * - "paused"
+ */
+static void do_info_status(Monitor *mon, QObject **ret_data)
+{
+ QString *qs;
+
if (vm_running) {
if (singlestep) {
- monitor_printf(mon, "VM status: running (single step mode)\n");
+ qs = qstring_from_str("running (single step mode)");
} else {
- monitor_printf(mon, "VM status: running\n");
+ qs = qstring_from_str("running");
}
- } else
- monitor_printf(mon, "VM status: paused\n");
+ } else {
+ qs = qstring_from_str("paused");
+ }
+
+ *ret_data = QOBJECT(qs);
}
/**
@@ -2123,7 +2143,8 @@ static const mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show the current VM status (running|paused)",
- .mhandler.info = do_info_status,
+ .user_print = do_info_status_print,
+ .mhandler.info_new = do_info_status,
},
{
.name = "pcmcia",
Return a QString with status information. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- monitor.c | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-)