Skip to contentSkip to conversation

Monitor commands

RFC PATCH In review Pavel Dovgaluk 3 participants 4 messages Jul 1, 2014 – Jul 2, 2014

lore
Share & tools
lore
#0 lore raw

RFC PATCH 8/22 Monitor commands

This patch adds commands to control replay from the monitor.

---

hmp-commands.hx +101 -0
index d0943b1..01d3203
@@ -1629,6 +1629,107 @@ passed since 1970, i.e. unix epoch.
 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
+
+    {
+        .name       = "replay_break",
+        .args_type  = "step:l",
+        .params     = "step",
+        .help       = "stop replaying at the specified replay step",
+        .mhandler.cmd = do_replay_break,
+    },
+
+STEXI
+@item replay_break @var{step}
+Stops replaying at the specified @var{step}.
+
+ETEXI
+
+    {
+        .name       = "replay_seek",
+        .args_type  = "step:l",
+        .params     = "step",
+        .help       = "seeks the replay log to the specified step",
+        .mhandler.cmd = do_replay_seek,
+    },
+
+STEXI
+@item replay_seek @var{step}
+Seeks the replay log to the specified @var{step}.
+
+ETEXI
+
+    {
+        .name       = "replay_events",
+        .args_type  = "",
+        .params     = "",
+        .help       = "shows events information from the replay log",
+        .mhandler.cmd = do_replay_events,
+    },
+
+STEXI
+@item replay_events
+Shows events information from the replay log.
+
+ETEXI
+
+    {
+        .name       = "replay_get_packet",
+        .args_type  = "id:l",
+        .params     = "id",
+        .help       = "retrieves network packet with the specified id",
+        .mhandler.cmd = do_replay_get_packet,
+    },
+
+STEXI
+@item replay_get_packet @var{id}
+Retrieves network packet with the specified @var{id}.
+
+ETEXI
+
+    {
+        .name       = "replay_set_packet",
+        .args_type  = "id:l,bytes:s?",
+        .params     = "id [bytes]",
+        .help       = "sets network packet with the specified id",
+        .mhandler.cmd = do_replay_set_packet,
+    },
+
+STEXI
+@item replay_set_packet @var{id} @var{bytes}
+Sets network packet with the specified @var{id}. While replaying,
+packet with this @var{id} will be replaced with the specified @var{bytes}.
+If @var{bytes} parameter is not specified, removes packet from storage of 
+modified packets.
+
+ETEXI
+
+    {
+        .name       = "replay_change",
+        .args_type  = "",
+        .params     = "",
+        .help       = "start execution of VM from the current replay step",
+        .mhandler.cmd = do_replay_change,
+    },
+
+STEXI
+@item replay_change
+Start execution of VM from the current replay step.
+
+ETEXI
+
+    {
         .name       = "chardev-add",
         .args_type  = "args:s",
         .params     = "args",
include/monitor/monitor.h +1 -0
index 3d6929d..d569a83
@@ -40,6 +40,7 @@ int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error **errp);
 void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
     GCC_FMT_ATTR(2, 0);
 void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+void monitor_print_bytes(Monitor *mon, const uint8_t *bytes, uint64_t length);
 void monitor_flush(Monitor *mon);
 int monitor_set_cpu(int cpu_index);
 int monitor_get_cpu_index(void);
monitor.c +110 -0

125 lines not on this page · raw message

{
+ monitor_printf(mon, "Could not set specified network packet.\n");
+ }
+ } else {
+ monitor_printf(mon, "You can set packets' contents only in replay PLAY mode.\n");
+ }
+}
+
+static void do_replay_change(Monitor *mon, const QDict *qdict) +{
+ if (replay_mode != REPLAY_PLAY) {
+ monitor_printf(mon, "Cannot start execution from non-play mode.\n");
+ return;
+ }
+
+ if (!replay_icount) {
+ monitor_printf(mon, "Execution can only be started from icount mode.\n");
+ return;
+ }
+
+ if (runstate_is_running()) {
+ monitor_printf(mon, "Stop the VM before executing of replay_change.\n");
+ return;
+ }
+
+ replay_change(mon);
+}
+
+
static void monitor_printc(Monitor *mon, int c)

 {
     monitor_printf(mon, "'");
@@ -2596,6 +2734,7 @@ int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error **errp)
     return fd;

}

+
/* Please update hmp-commands.hx when adding or changing commands */

 static mon_cmd_t info_cmds[] = {
     {
#1 lore raw
Quoted 4 lines · Pavel Dovgaluk

This patch adds commands to control replay from the monitor.

---

What are the counterpart QMP commands? It is seldom right to add an HMP command unless the same thing can be done via QMP.

monitor.c int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error **errp) · line 2739

Quoted 7 lines
monitor.c +1 -0
@@ -2596,6 +2734,7 @@ int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error **errp)
     return fd;
 }
 
+
 /* Please update hmp-commands.hx when adding or changing commands */
 static mon_cmd_t info_cmds[] = {

Spurious newline addition?

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
Quoted 6 lines

-----Original Message-----
From: Eric Blake [mailto:[email protected]]
Sent: Tuesday, July 01, 2014 9:33 PM
To: Pavel Dovgaluk; 'QEMU Developers'
Subject: Re: [Qemu-devel] [RFC PATCH 08/22] Monitor commands

Quoted 8 lines
Quoted 4 lines · Pavel Dovgaluk

This patch adds commands to control replay from the monitor.

---

What are the counterpart QMP commands? It is seldom right to add an HMP command unless the same thing can be done via QMP.

We haven't controlled qemu through QMP yet, thus haven't implemented QMP support for replay commands.

Today I started adding this support and noticed, that QMP in current master branch is broken - it does not reply anything except information at start.

Quoted 10 lines

Review int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error

Quoted 1 line
(quoted diff) +0 -0
@@ -2596,6 +2734,7 @@ int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error

**errp)

monitor.c void monitor_printf(Monitor *mon, const char *fmt, ...)

Quoted 6 lines
monitor.c +1 -0
     return fd;
 }
 
+
 /* Please update hmp-commands.hx when adding or changing commands */
 static mon_cmd_t info_cmds[] = {

Spurious newline addition?

Thanks, forgot to undo this.

Pavel Dovgaluk

#3 lore raw
Quoted 12 lines · Pavel Dovgaluk
Quoted 12 lines

-----Original Message-----
From: Eric Blake [mailto:[email protected]]
Sent: Tuesday, July 01, 2014 9:33 PM
To: Pavel Dovgaluk; 'QEMU Developers'
Subject: Re: [Qemu-devel] [RFC PATCH 08/22] Monitor commands

Quoted 4 lines · Pavel Dovgaluk

This patch adds commands to control replay from the monitor.

---

Quoted 9 lines
Quoted 2 lines

What are the counterpart QMP commands? It is seldom right to add an HMP command unless the same thing can be done via QMP.

We haven't controlled qemu through QMP yet, thus haven't implemented QMP support for replay commands.

Today I started adding this support and noticed, that QMP in current master branch is broken - it does not reply anything except information at start.

On Windows hosts only. I've sent a fix for this problem yesterday:
https://lists.gnu.org/archive/html/qemu-devel/2014-07/msg00169.html

Quoted 17 lines
Quoted 10 lines

Review int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error

Quoted 1 line
(quoted diff) +0 -0
@@ -2596,6 +2734,7 @@ int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error

**errp)

monitor.c void monitor_printf(Monitor *mon, const char *fmt, ...)

Quoted 6 lines
monitor.c +1 -0
     return fd;
 }
 
+
 /* Please update hmp-commands.hx when adding or changing commands */
 static mon_cmd_t info_cmds[] = {

Spurious newline addition?

Thanks, forgot to undo this.

Pavel Dovgaluk

Signature · 1 line
Kirill