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