/* The tfile target. */
+static const target_info tfile_target_info = {
+ "tfile",
+ N_("Local trace dump file"),
+ N_("Use a trace file as a target. Specify the filename of the trace file.")
+};
+
class tfile_target final : public tracefile_target
{
public:
- const char *shortname () override
- { return "tfile"; }
-
- const char *longname () override
- { return _("Local trace dump file"); }
-
- const char *doc () override
- {
- return _("\
-Use a trace file as a target. Specify the filename of the trace file.");
- }
+ const target_info &info () const override
+ { return tfile_target_info; }
- void open (const char *, int) override;
void close () override;
void fetch_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
= (struct tfile_trace_file_writer *) self;
gdb::optional<std::string> tdesc
- = target_fetch_description_xml (target_stack);
+ = target_fetch_description_xml (current_top_target ());
if (!tdesc)
return;
error (_("Premature end of file while reading trace file"));
}
-void
-tfile_target::open (const char *arg, int from_tty)
+/* Open the tfile target. */
+
+static void
+tfile_target_open (const char *arg, int from_tty)
{
int flags;
int scratch_chan;
END_CATCH
inferior_appeared (current_inferior (), TFILE_PID);
- inferior_ptid = pid_to_ptid (TFILE_PID);
+ inferior_ptid = ptid_t (TFILE_PID);
add_thread_silent (inferior_ptid);
if (ts->traceframe_count <= 0)
void
tfile_target::close ()
{
- int pid;
-
if (trace_fd < 0)
return;
- pid = ptid_get_pid (inferior_ptid);
inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */
- exit_inferior_silent (pid);
+ exit_inferior_silent (current_inferior ());
::close (trace_fd);
trace_fd = -1;
/* Make sure we stay within block bounds. */
if (offset + regsize > trace_regblock_size)
break;
- if (regcache_register_status (regcache, regn) == REG_UNKNOWN)
+ if (regcache->get_register_status (regn) == REG_UNKNOWN)
{
if (regno == regn)
{
- regcache_raw_supply (regcache, regno, regs + offset);
+ regcache->raw_supply (regno, regs + offset);
break;
}
else if (regno == -1)
{
- regcache_raw_supply (regcache, regn, regs + offset);
+ regcache->raw_supply (regn, regs + offset);
}
}
}
void
_initialize_tracefile_tfile (void)
{
- add_target_with_completer (&tfile_ops, filename_completer);
+ add_target (tfile_target_info, tfile_target_open, filename_completer);
}