summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--monitor.c5
-rw-r--r--monitor.h1
-rw-r--r--qemu-config.c3
-rw-r--r--vl.c3
4 files changed, 11 insertions, 1 deletions
diff --git a/monitor.c b/monitor.c
index e602480ebb..a33cdc2a00 100644
--- a/monitor.c
+++ b/monitor.c
@@ -351,7 +351,10 @@ static void monitor_json_emitter(Monitor *mon, const QObject *data)
{
QString *json;
- json = qobject_to_json(data);
+ if (mon->flags & MONITOR_USE_PRETTY)
+ json = qobject_to_json_pretty(data);
+ else
+ json = qobject_to_json(data);
assert(json != NULL);
qstring_append_chr(json, '\n');
diff --git a/monitor.h b/monitor.h
index 38b22a4b28..f2122b5884 100644
--- a/monitor.h
+++ b/monitor.h
@@ -14,6 +14,7 @@ extern Monitor *default_mon;
#define MONITOR_IS_DEFAULT 0x01
#define MONITOR_USE_READLINE 0x02
#define MONITOR_USE_CONTROL 0x04
+#define MONITOR_USE_PRETTY 0x08
/* flags for monitor commands */
#define MONITOR_CMD_ASYNC 0x0001
diff --git a/qemu-config.c b/qemu-config.c
index e3b746cc2b..6052a289e9 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -283,6 +283,9 @@ static QemuOptsList qemu_mon_opts = {
},{
.name = "default",
.type = QEMU_OPT_BOOL,
+ },{
+ .name = "pretty",
+ .type = QEMU_OPT_BOOL,
},
{ /* end of list */ }
},
diff --git a/vl.c b/vl.c
index d352d18cfe..939ee87b66 100644
--- a/vl.c
+++ b/vl.c
@@ -1562,6 +1562,9 @@ static int mon_init_func(QemuOpts *opts, void *opaque)
exit(1);
}
+ if (qemu_opt_get_bool(opts, "pretty", 0))
+ flags |= MONITOR_USE_PRETTY;
+
if (qemu_opt_get_bool(opts, "default", 0))
flags |= MONITOR_IS_DEFAULT;