mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
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>
This commit is contained in:
parent
39c350ee12
commit
33577b47c6
10 changed files with 396 additions and 33 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue