@@ -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
+@item replay_info
+Shows information about replay process.
+ETEXI
+
STEXI
@end table
ETEXI
@@ -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,22 @@ 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_NONE:
+ monitor_printf(mon, "Replay is not enabled\n");
+ break;
+ default:
+ monitor_printf(mon, "Replay mode: %s ", replay_get_mode_name());
+ if (replay_mode == REPLAY_PLAY) {
+ monitor_printf(mon, "(%s)", replay_get_play_submode_name());
+ }
+ monitor_printf(mon, "\n\tcurrent step: %" PRId64 "\n", replay_get_current_step());
+ break;
+ }
+}
+
static void monitor_printc(Monitor *mon, int c)
{
monitor_printf(mon, "'");
@@ -3491,3 +3491,30 @@
# Since: 2.1
##
{ 'command': 'rtc-reset-reinjection' }
+
+##
+# @ReplayInfo:
+#
+# Information about replay process
+#
+# @mode: replay mode (none, play, record)
+#
+# @submode: play submode
+#
+# @step: current step of record or play
+#
+# Since: 2.2
+##
+{ 'type': 'ReplayInfo',
+ 'data': {'mode': 'str', 'submode': 'str', 'step': 'uint64'} }
+
+##
+# @replay_info
+#
+# Query the status of replay engine
+#
+# Returns: @ReplayInfo reflecting the status
+#
+# Since: 2.2
+##
+{ 'command': 'replay_info', 'returns': 'ReplayInfo' }
@@ -3755,3 +3755,17 @@ Example:
<- { "return": {} }
EQMP
+
+ {
+ .name = "replay_info",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_marshal_input_replay_info,
+ },
+
+SQMP
+replay_info
+-----------
+
+Shows information about replay process.
+
+EQMP
@@ -7,3 +7,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
new file mode 100755
@@ -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 = g_strdup(replay_get_mode_name());
+ info->submode = g_strdup(replay_get_play_submode_name());
+ info->step = replay_get_current_step();
+
+ return info;
+}
@@ -638,3 +638,28 @@ void replay_data_buffer(unsigned char *data, size_t size)
replay_put_array(data, size);
}
}
+
+const char *replay_get_mode_name(void)
+{
+ switch (replay_mode) {
+ case REPLAY_NONE:
+ return "none";
+ case REPLAY_PLAY:
+ return "replay";
+ case REPLAY_SAVE:
+ return "record";
+ default:
+ return "unknown";
+ }
+}
+
+const char *replay_get_play_submode_name(void)
+{
+ switch (play_submode) {
+ case REPLAY_PLAY_NORMAL:
+ return "normal";
+ case REPLAY_PLAY_UNKNOWN:
+ default:
+ return "unknown";
+ }
+}
@@ -52,6 +52,10 @@ extern int replay_icount;
/*! Returns replay play submode */
int replay_get_play_submode(void);
+/*! Returns current mode name */
+const char *replay_get_mode_name(void);
+/*! Returns replay-play submode name */
+const char *replay_get_play_submode_name(void);
/* Replay process control functions */
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 <pavel.dovgaluk@ispras.ru> --- hmp-commands.hx | 13 +++++++++++++ monitor.c | 17 +++++++++++++++++ qapi-schema.json | 27 +++++++++++++++++++++++++++ qmp-commands.hx | 14 ++++++++++++++ replay/Makefile.objs | 1 + replay/replay-qmp.c | 29 +++++++++++++++++++++++++++++ replay/replay.c | 25 +++++++++++++++++++++++++ replay/replay.h | 4 ++++ 8 files changed, 130 insertions(+), 0 deletions(-) create mode 100755 replay/replay-qmp.c