xref: /openbmc/qemu/replay/replay-debugging.c (revision e3b09ad2)
1 /*
2  * replay-debugging.c
3  *
4  * Copyright (c) 2010-2020 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 
12 #include "qemu/osdep.h"
13 #include "qapi/error.h"
14 #include "sysemu/replay.h"
15 #include "replay-internal.h"
16 #include "monitor/hmp.h"
17 #include "monitor/monitor.h"
18 #include "qapi/qapi-commands-replay.h"
19 
20 void hmp_info_replay(Monitor *mon, const QDict *qdict)
21 {
22     if (replay_mode == REPLAY_MODE_NONE) {
23         monitor_printf(mon, "Record/replay is not active\n");
24     } else {
25         monitor_printf(mon,
26             "%s execution '%s': instruction count = %"PRId64"\n",
27             replay_mode == REPLAY_MODE_RECORD ? "Recording" : "Replaying",
28             replay_get_filename(), replay_get_current_icount());
29     }
30 }
31 
32 ReplayInfo *qmp_query_replay(Error **errp)
33 {
34     ReplayInfo *retval = g_new0(ReplayInfo, 1);
35 
36     retval->mode = replay_mode;
37     if (replay_get_filename()) {
38         retval->filename = g_strdup(replay_get_filename());
39         retval->has_filename = true;
40     }
41     retval->icount = replay_get_current_icount();
42     return retval;
43 }
44