gdb: tweak format of infrun debug log
[deliverable/binutils-gdb.git] / gdb / bfd-target.c
index 7ac8bc3c612c7ca3194b0deee826873f68d6a971..b75abd7fb0e62952865862503c48f528b95a1c08 100644 (file)
@@ -1,6 +1,6 @@
 /* Very simple "bfd" target, for GDB, the GNU debugger.
 
-   Copyright (C) 2003-2018 Free Software Foundation, Inc.
+   Copyright (C) 2003-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "gdb_bfd.h"
 
 /* A target that wraps a BFD.  */
+
+static const target_info target_bfd_target_info = {
+  "bfd",
+  N_("BFD backed target"),
+  N_("You should never see this")
+};
+
 class target_bfd : public target_ops
 {
 public:
   explicit target_bfd (struct bfd *bfd);
   ~target_bfd () override;
 
-  const char *shortname () override
-  { return "bfd"; }
-
-  const char *longname () override
-  { return _("BFD backed target"); }
+  const target_info &info () const override
+  { return target_bfd_target_info; }
 
-  const char *doc () override
-  { return _("You should never see this"); }
+  strata stratum () const override { return file_stratum; }
 
   void close () override;
 
@@ -52,7 +55,7 @@ public:
 
 private:
   /* The BFD we're wrapping.  */
-  struct bfd *m_bfd;
+  gdb_bfd_ref_ptr m_bfd;
 
   /* The section table build from the ALLOC sections in BFD.  Note
      that we can't rely on extracting the BFD from a random section in
@@ -89,10 +92,8 @@ target_bfd::get_section_table ()
 }
 
 target_bfd::target_bfd (struct bfd *abfd)
+  : m_bfd (gdb_bfd_ref_ptr::new_reference (abfd))
 {
-  this->to_stratum = file_stratum;
-  m_bfd = abfd;
-  gdb_bfd_ref (abfd);
   m_table.sections = NULL;
   m_table.sections_end = NULL;
   build_section_table (abfd, &m_table.sections, &m_table.sections_end);
@@ -100,7 +101,6 @@ target_bfd::target_bfd (struct bfd *abfd)
 
 target_bfd::~target_bfd ()
 {
-  gdb_bfd_unref (m_bfd);
   xfree (m_table.sections);
 }
 
This page took 0.02615 seconds and 4 git commands to generate.