]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/ctf.c
target factories, target open and multiple instances of targets
[thirdparty/binutils-gdb.git] / gdb / ctf.c
index 90d6f6c025f6e3bc94afb204aa6ee58b067f9d5f..cae5d221cb1c3f4a8143df60ea12b0df75101ccd 100644 (file)
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
 
 /* The CTF target.  */
 
+static const target_info ctf_target_info = {
+  "ctf",
+  N_("CTF file"),
+  N_("(Use a CTF directory as a target.\n\
+Specify the filename of the CTF directory.")
+};
+
 class ctf_target final : public tracefile_target
 {
 public:
-  const char *shortname () override
-  { return "ctf"; }
-
-  const char *longname () override
-  { return _("CTF file"); }
+  const target_info &info () const override
+  { return ctf_target_info; }
 
-  const char *doc () override
-  {
-    return _("\
-Use a CTF directory as a target.\n\
-Specify the filename of the CTF directory.");
-  }
-
-  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,
@@ -1108,8 +1104,8 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
    definitions from the first packet.  Set the start position at the
    second packet which contains events on trace blocks.  */
 
-void
-ctf_target::open (const char *dirname, int from_tty)
+static void
+ctf_target_open (const char *dirname, int from_tty)
 {
   struct bt_ctf_event *event;
   uint32_t event_id;
@@ -1724,6 +1720,6 @@ void
 _initialize_ctf (void)
 {
 #if HAVE_LIBBABELTRACE
-  add_target_with_completer (&ctf_ops, filename_completer);
+  add_target (ctf_target_info, ctf_target_open, filename_completer);
 #endif
 }