aboutsummaryrefslogtreecommitdiff
path: root/replay/replay-events.c
diff options
context:
space:
mode:
authorPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>2016-03-14 10:44:36 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-03-15 18:23:40 +0100
commit33577b47c64435fcc2a1bc01c7e82534256f1fc3 (patch)
tree232204ccccc783d694b70e70d366e20a14a286ee /replay/replay-events.c
parent39c350ee12e733070e63d64a21bd42607366ea99 (diff)
replay: character devices
This patch implements record and replay of character devices. It records chardevs communication in replay mode. Recorded information include data read from backend and counter of bytes written from frontend to backend to preserve frontend internal state. If character device was configured through the command line in record mode, then in replay mode it should be also added to command line. Backend of the character device could be changed in replay mode. Replaying of devices that perform ioctl and get_msgfd operations is not supported. gdbstub which also acts as a backend is not recorded to allow controlling the replaying through gdb. Monitor backends are also not recorded. Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru> Message-Id: <20160314074436.4980.83856.stgit@PASHA-ISP> [Add stubs. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'replay/replay-events.c')
-rw-r--r--replay/replay-events.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/replay/replay-events.c b/replay/replay-events.c
index 2628109ed8..ca940f70e7 100644
--- a/replay/replay-events.c
+++ b/replay/replay-events.c
@@ -48,6 +48,9 @@ static void replay_run_event(Event *event)
case REPLAY_ASYNC_EVENT_INPUT_SYNC:
qemu_input_event_sync_impl();
break;
+ case REPLAY_ASYNC_EVENT_CHAR_READ:
+ replay_event_char_read_run(event->opaque);
+ break;
default:
error_report("Replay: invalid async event ID (%d) in the queue",
event->event_kind);
@@ -102,9 +105,9 @@ void replay_clear_events(void)
}
/*! Adds specified async event to the queue */
-static void replay_add_event(ReplayAsyncEventKind event_kind,
- void *opaque,
- void *opaque2, uint64_t id)
+void replay_add_event(ReplayAsyncEventKind event_kind,
+ void *opaque,
+ void *opaque2, uint64_t id)
{
assert(event_kind < REPLAY_ASYNC_COUNT);
@@ -168,6 +171,9 @@ static void replay_save_event(Event *event, int checkpoint)
break;
case REPLAY_ASYNC_EVENT_INPUT_SYNC:
break;
+ case REPLAY_ASYNC_EVENT_CHAR_READ:
+ replay_event_char_read_save(event->opaque);
+ break;
default:
error_report("Unknown ID %d of replay event", read_event_kind);
exit(1);
@@ -221,6 +227,11 @@ static Event *replay_read_event(int checkpoint)
event->event_kind = read_event_kind;
event->opaque = 0;
return event;
+ case REPLAY_ASYNC_EVENT_CHAR_READ:
+ event = g_malloc0(sizeof(Event));
+ event->event_kind = read_event_kind;
+ event->opaque = replay_event_char_read_load();
+ return event;
default:
error_report("Unknown ID %d of replay event", read_event_kind);
exit(1);