1*5b5968c4SPhilippe Mathieu-Daudé /* 2*5b5968c4SPhilippe Mathieu-Daudé * QEMU replay core API 3*5b5968c4SPhilippe Mathieu-Daudé * 4*5b5968c4SPhilippe Mathieu-Daudé * Copyright (c) 2010-2015 Institute for System Programming 5*5b5968c4SPhilippe Mathieu-Daudé * of the Russian Academy of Sciences. 6*5b5968c4SPhilippe Mathieu-Daudé * 7*5b5968c4SPhilippe Mathieu-Daudé * This work is licensed under the terms of the GNU GPL, version 2 or later. 8*5b5968c4SPhilippe Mathieu-Daudé * See the COPYING file in the top-level directory. 9*5b5968c4SPhilippe Mathieu-Daudé */ 10*5b5968c4SPhilippe Mathieu-Daudé 11*5b5968c4SPhilippe Mathieu-Daudé #ifndef EXEC_REPLAY_H 12*5b5968c4SPhilippe Mathieu-Daudé #define EXEC_REPLAY_H 13*5b5968c4SPhilippe Mathieu-Daudé 14*5b5968c4SPhilippe Mathieu-Daudé #include "qapi/qapi-types-replay.h" 15*5b5968c4SPhilippe Mathieu-Daudé 16*5b5968c4SPhilippe Mathieu-Daudé extern ReplayMode replay_mode; 17*5b5968c4SPhilippe Mathieu-Daudé 18*5b5968c4SPhilippe Mathieu-Daudé /* Replay process control functions */ 19*5b5968c4SPhilippe Mathieu-Daudé 20*5b5968c4SPhilippe Mathieu-Daudé /* Enables recording or saving event log with specified parameters */ 21*5b5968c4SPhilippe Mathieu-Daudé void replay_configure(struct QemuOpts *opts); 22*5b5968c4SPhilippe Mathieu-Daudé /* Initializes timers used for snapshotting and enables events recording */ 23*5b5968c4SPhilippe Mathieu-Daudé void replay_start(void); 24*5b5968c4SPhilippe Mathieu-Daudé /* Closes replay log file and frees other resources. */ 25*5b5968c4SPhilippe Mathieu-Daudé void replay_finish(void); 26*5b5968c4SPhilippe Mathieu-Daudé /* Adds replay blocker with the specified error description */ 27*5b5968c4SPhilippe Mathieu-Daudé void replay_add_blocker(const char *feature); 28*5b5968c4SPhilippe Mathieu-Daudé /* Returns name of the replay log file */ 29*5b5968c4SPhilippe Mathieu-Daudé const char *replay_get_filename(void); 30*5b5968c4SPhilippe Mathieu-Daudé 31*5b5968c4SPhilippe Mathieu-Daudé /* 32*5b5968c4SPhilippe Mathieu-Daudé * Start making one step in backward direction. 33*5b5968c4SPhilippe Mathieu-Daudé * Used by gdbstub for backwards debugging. 34*5b5968c4SPhilippe Mathieu-Daudé * Returns true on success. 35*5b5968c4SPhilippe Mathieu-Daudé */ 36*5b5968c4SPhilippe Mathieu-Daudé bool replay_reverse_step(void); 37*5b5968c4SPhilippe Mathieu-Daudé /* 38*5b5968c4SPhilippe Mathieu-Daudé * Start searching the last breakpoint/watchpoint. 39*5b5968c4SPhilippe Mathieu-Daudé * Used by gdbstub for backwards debugging. 40*5b5968c4SPhilippe Mathieu-Daudé * Returns true if the process successfully started. 41*5b5968c4SPhilippe Mathieu-Daudé */ 42*5b5968c4SPhilippe Mathieu-Daudé bool replay_reverse_continue(void); 43*5b5968c4SPhilippe Mathieu-Daudé /* 44*5b5968c4SPhilippe Mathieu-Daudé * Returns true if replay module is processing 45*5b5968c4SPhilippe Mathieu-Daudé * reverse_continue or reverse_step request 46*5b5968c4SPhilippe Mathieu-Daudé */ 47*5b5968c4SPhilippe Mathieu-Daudé bool replay_running_debug(void); 48*5b5968c4SPhilippe Mathieu-Daudé /* Called in reverse debugging mode to collect breakpoint information */ 49*5b5968c4SPhilippe Mathieu-Daudé void replay_breakpoint(void); 50*5b5968c4SPhilippe Mathieu-Daudé /* Called when gdb is attached to gdbstub */ 51*5b5968c4SPhilippe Mathieu-Daudé void replay_gdb_attached(void); 52*5b5968c4SPhilippe Mathieu-Daudé 53*5b5968c4SPhilippe Mathieu-Daudé /* Interrupts and exceptions */ 54*5b5968c4SPhilippe Mathieu-Daudé 55*5b5968c4SPhilippe Mathieu-Daudé /* Called by exception handler to write or read exception processing events */ 56*5b5968c4SPhilippe Mathieu-Daudé bool replay_exception(void); 57*5b5968c4SPhilippe Mathieu-Daudé /* 58*5b5968c4SPhilippe Mathieu-Daudé * Used to determine that exception is pending. 59*5b5968c4SPhilippe Mathieu-Daudé * Does not proceed to the next event in the log. 60*5b5968c4SPhilippe Mathieu-Daudé */ 61*5b5968c4SPhilippe Mathieu-Daudé bool replay_has_exception(void); 62*5b5968c4SPhilippe Mathieu-Daudé /* 63*5b5968c4SPhilippe Mathieu-Daudé * Called by interrupt handlers to write or read interrupt processing events. 64*5b5968c4SPhilippe Mathieu-Daudé * Returns true if interrupt should be processed. 65*5b5968c4SPhilippe Mathieu-Daudé */ 66*5b5968c4SPhilippe Mathieu-Daudé bool replay_interrupt(void); 67*5b5968c4SPhilippe Mathieu-Daudé /* 68*5b5968c4SPhilippe Mathieu-Daudé * Tries to read interrupt event from the file. 69*5b5968c4SPhilippe Mathieu-Daudé * Returns true, when interrupt request is pending. 70*5b5968c4SPhilippe Mathieu-Daudé */ 71*5b5968c4SPhilippe Mathieu-Daudé bool replay_has_interrupt(void); 72*5b5968c4SPhilippe Mathieu-Daudé 73*5b5968c4SPhilippe Mathieu-Daudé /* Processing data from random generators */ 74*5b5968c4SPhilippe Mathieu-Daudé 75*5b5968c4SPhilippe Mathieu-Daudé /* Saves the values from the random number generator */ 76*5b5968c4SPhilippe Mathieu-Daudé void replay_save_random(int ret, void *buf, size_t len); 77*5b5968c4SPhilippe Mathieu-Daudé /* Loads the saved values for the random number generator */ 78*5b5968c4SPhilippe Mathieu-Daudé int replay_read_random(void *buf, size_t len); 79*5b5968c4SPhilippe Mathieu-Daudé 80*5b5968c4SPhilippe Mathieu-Daudé #endif 81