+static const char record_longname[]
+ = N_("Process record and replay target");
+static const char record_doc[]
+ = N_("Log program while executing and replay execution from log.");
+
+/* Base class implementing functionality common to both the
+ "record-full" and "record-core" targets. */
+
+class record_full_base_target : public target_ops
+{
+public:
+ const target_info &info () const override = 0;
+
+ strata stratum () const override { return record_stratum; }
+
+ void close () override;
+ void async (int) override;
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
+ bool stopped_by_watchpoint () override;
+ bool stopped_data_address (CORE_ADDR *) override;
+
+ bool stopped_by_sw_breakpoint () override;
+ bool supports_stopped_by_sw_breakpoint () override;
+
+ bool stopped_by_hw_breakpoint () override;
+ bool supports_stopped_by_hw_breakpoint () override;
+
+ bool can_execute_reverse () override;
+
+ /* Add bookmark target methods. */
+ gdb_byte *get_bookmark (const char *, int) override;
+ void goto_bookmark (const gdb_byte *, int) override;
+ enum exec_direction_kind execution_direction () override;
+ enum record_method record_method (ptid_t ptid) override;
+ void info_record () override;
+ void save_record (const char *filename) override;
+ bool supports_delete_record () override;
+ void delete_record () override;
+ bool record_is_replaying (ptid_t ptid) override;
+ bool record_will_replay (ptid_t ptid, int dir) override;
+ void record_stop_replaying () override;
+ void goto_record_begin () override;
+ void goto_record_end () override;
+ void goto_record (ULONGEST insn) override;
+};
+
+/* The "record-full" target. */
+
+static const target_info record_full_target_info = {
+ "record-full",
+ record_longname,
+ record_doc,
+};
+
+class record_full_target final : public record_full_base_target
+{
+public:
+ const target_info &info () const override
+ { return record_full_target_info; }
+
+ void commit_resume () override;
+ void resume (ptid_t, int, enum gdb_signal) override;
+ void disconnect (const char *, int) override;
+ void detach (inferior *, int) override;
+ void mourn_inferior () override;
+ void kill () override;
+ void store_registers (struct regcache *, int) override;
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) override;
+ int insert_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
+ int remove_breakpoint (struct gdbarch *,
+ struct bp_target_info *,
+ enum remove_bp_reason) override;
+};
+
+/* The "record-core" target. */
+
+static const target_info record_full_core_target_info = {
+ "record-core",
+ record_longname,
+ record_doc,
+};
+
+class record_full_core_target final : public record_full_base_target
+{
+public:
+ const target_info &info () const override
+ { return record_full_core_target_info; }
+
+ void resume (ptid_t, int, enum gdb_signal) override;
+ void disconnect (const char *, int) override;
+ void kill () override;
+ void fetch_registers (struct regcache *regcache, int regno) override;
+ void prepare_to_store (struct regcache *regcache) override;
+ void store_registers (struct regcache *, int) override;
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) override;
+ int insert_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
+ int remove_breakpoint (struct gdbarch *,
+ struct bp_target_info *,
+ enum remove_bp_reason) override;
+
+ bool has_execution (inferior *inf) override;
+};
+
+static record_full_target record_full_ops;
+static record_full_core_target record_full_core_ops;
+
+void
+record_full_target::detach (inferior *inf, int from_tty)
+{
+ record_detach (this, inf, from_tty);
+}
+
+void
+record_full_target::disconnect (const char *args, int from_tty)
+{
+ record_disconnect (this, args, from_tty);
+}
+
+void
+record_full_core_target::disconnect (const char *args, int from_tty)
+{
+ record_disconnect (this, args, from_tty);
+}
+
+void
+record_full_target::mourn_inferior ()
+{
+ record_mourn_inferior (this);
+}
+
+void
+record_full_target::kill ()
+{
+ record_kill (this);
+}