[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v3 46/49] replay: replay_info command
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [RFC PATCH v3 46/49] replay: replay_info command |
Date: |
Thu, 31 Jul 2014 16:57:48 +0400 |
User-agent: |
StGit/0.16 |
This patch adds support for replay_info monitor command. This command
returns the information about replay execution (replay mode and current step).
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
hmp-commands.hx | 13 +++++++++++++
monitor.c | 20 ++++++++++++++++++++
qapi-schema.json | 27 +++++++++++++++++++++++++++
qmp-commands.hx | 22 ++++++++++++++++++++++
replay/Makefile.objs | 1 +
replay/replay-qmp.c | 29 +++++++++++++++++++++++++++++
6 files changed, 112 insertions(+), 0 deletions(-)
create mode 100755 replay/replay-qmp.c
diff --git a/hmp-commands.hx b/hmp-commands.hx
index d0943b1..19174f1 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1788,6 +1788,19 @@ STEXI
show available trace events and their state
ETEXI
+ {
+ .name = "replay_info",
+ .args_type = "",
+ .params = "",
+ .help = "show replay info",
+ .mhandler.cmd = do_replay_info,
+ },
+
+STEXI
address@hidden replay_info
+Shows information about replay process.
+ETEXI
+
STEXI
@end table
ETEXI
diff --git a/monitor.c b/monitor.c
index 5bc70a6..61fb11c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -73,6 +73,7 @@
#include "block/qapi.h"
#include "qapi/qmp-event.h"
#include "qapi-event.h"
+#include "replay/replay.h"
/* for pic/irq_info */
#if defined(TARGET_SPARC)
@@ -1173,6 +1174,25 @@ static void do_watchdog_action(Monitor *mon, const QDict
*qdict)
}
}
+static void do_replay_info(Monitor *mon, const QDict *qdict)
+{
+ switch (replay_mode) {
+ case REPLAY_MODE_NONE:
+ monitor_printf(mon, "Replay is not enabled\n");
+ break;
+ default:
+ monitor_printf(mon, "Replay mode: %s ",
+ ReplayMode_lookup[replay_mode]);
+ if (replay_mode == REPLAY_MODE_PLAY) {
+ monitor_printf(mon, "(%s)",
+ ReplaySubmode_lookup[replay_get_play_submode()]);
+ }
+ monitor_printf(mon, "\n\tcurrent step: %" PRId64 "\n",
+ replay_get_current_step());
+ break;
+ }
+}
+
static void monitor_printc(Monitor *mon, int c)
{
monitor_printf(mon, "'");
diff --git a/qapi-schema.json b/qapi-schema.json
index 3f2dab4..93a7ff7 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3523,3 +3523,30 @@
##
{ 'enum': 'ReplaySubmode',
'data': [ 'unknown', 'normal' ] }
+
+##
+# @ReplayInfo:
+#
+# Information about replay process
+#
+# @mode: replay mode (none, play, record)
+#
+# @submode: play submode (reverse or normal execution)
+#
+# @step: current step of record or play
+#
+# Since: 2.2
+##
+{ 'type': 'ReplayInfo',
+ 'data': {'mode': 'ReplayMode', 'submode': 'ReplaySubmode', 'step': 'uint64'}
}
+
+##
+# @replay-info
+#
+# Query the status of replay engine
+#
+# Returns: @ReplayInfo reflecting the status
+#
+# Since: 2.2
+##
+{ 'command': 'replay-info', 'returns': 'ReplayInfo' }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 4be4765..67dd886 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3755,3 +3755,25 @@ Example:
<- { "return": {} }
EQMP
+
+ {
+ .name = "replay-info",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_marshal_input_replay_info,
+ },
+
+SQMP
+replay-info
+-----------
+
+Shows information about replay process. This information includes
+current execution step (number of executed processor instructions),
+replay mode (record, play or none), and replay submode (reverse or
+normal execution in play mode).
+
+Example:
+
+-> { "execute": "replay-info" }
+<- { "return": { "step": 651488674, "mode": "record", "submode": "unknown" } }
+
+EQMP
diff --git a/replay/Makefile.objs b/replay/Makefile.objs
index f4eef74..62eba1b 100755
--- a/replay/Makefile.objs
+++ b/replay/Makefile.objs
@@ -8,3 +8,4 @@ obj-y += replay-net.o
obj-y += replay-audio.o
obj-y += replay-char.o
obj-y += replay-usb.o
+obj-y += replay-qmp.o
diff --git a/replay/replay-qmp.c b/replay/replay-qmp.c
new file mode 100755
index 0000000..4a0017d
--- /dev/null
+++ b/replay/replay-qmp.c
@@ -0,0 +1,29 @@
+/*
+ * replay-qmp.c
+ *
+ * Copyright (c) 2010-2014 Institute for System Programming
+ * of the Russian Academy of Sciences.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#include "qemu-common.h"
+#include "sysemu/sysemu.h"
+#include "qmp-commands.h"
+#include "qapi/qmp/qobject.h"
+#include "qapi/qmp-input-visitor.h"
+#include "replay/replay.h"
+#include "replay/replay-internal.h"
+
+ReplayInfo *qmp_replay_info(Error **errp)
+{
+ ReplayInfo *info = g_malloc0(sizeof(*info));
+
+ info->mode = replay_mode;
+ info->submode = replay_get_play_submode();
+ info->step = replay_get_current_step();
+
+ return info;
+}
- [Qemu-devel] [RFC PATCH v3 36/49] pl031: vmstate in replay mode, (continued)
- [Qemu-devel] [RFC PATCH v3 36/49] pl031: vmstate in replay mode, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 37/49] replay: initialization and deinitialization, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 38/49] replay: command line options, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 39/49] replay: snapshotting the virtual machine, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 40/49] replay: recording of the user input, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 41/49] tap-win32: destroy the thread at exit, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 42/49] replay: network packets record/replay, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 43/49] replay: audio data record/replay, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 44/49] replay: serial port, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 45/49] replay: USB passthrough, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 46/49] replay: replay_info command,
Pavel Dovgalyuk <=
- [Qemu-devel] [RFC PATCH v3 47/49] replay: replay_break command, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 48/49] replay: replay_seek_step command, Pavel Dovgalyuk, 2014/07/31
- [Qemu-devel] [RFC PATCH v3 49/49] gdbstub: reverse debugging, Pavel Dovgalyuk, 2014/07/31