[PowerPC] Fix indentation in arch/ppc-linux-common.c
[deliverable/binutils-gdb.git] / gdb / tracefile-tfile.c
index d224ad9760ad9ff7be1d2358179a5ac148325d2e..6996e3d1e5474d78debd8f2dbb47f1d53335670b 100644 (file)
 
 /* 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,
@@ -311,7 +307,7 @@ tfile_write_tdesc (struct trace_file_writer *self)
     = (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;
@@ -451,8 +447,10 @@ tfile_read (gdb_byte *readbuf, int size)
     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;
@@ -557,7 +555,7 @@ tfile_target::open (const char *arg, int from_tty)
   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)
@@ -617,14 +615,11 @@ tfile_interp_line (char *line, struct uploaded_tp **utpp,
 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;
@@ -896,16 +891,16 @@ tfile_target::fetch_registers (struct regcache *regcache, int regno)
          /* 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);
                }
            }
        }
@@ -1139,5 +1134,5 @@ tfile_append_tdesc_line (const char *line)
 void
 _initialize_tracefile_tfile (void)
 {
-  add_target_with_completer (&tfile_ops, filename_completer);
+  add_target (tfile_target_info, tfile_target_open, filename_completer);
 }
This page took 0.025288 seconds and 4 git commands to generate.