I noticed that target_bfd was using manual reference counting for the
BFD it held. This patch changes it to use gdb_bfd_ref_ptr instead.
Tested by the buildbot.
ChangeLog
2018-05-04 Tom Tromey <tom@tromey.com>
* bfd-target.c (target_bfd::m_bfd): Now a gdb_bfd_ref_ptr.
(target_bfd::target_bfd, target_bfd::~target_bfd): Update.
+2018-05-04 Tom Tromey <tom@tromey.com>
+
+ * bfd-target.c (target_bfd::m_bfd): Now a gdb_bfd_ref_ptr.
+ (target_bfd::target_bfd, target_bfd::~target_bfd): Update.
+
2018-05-04 Ulrich Weigand <uweigand@de.ibm.com>
* spu-linux-nat.c (spu_linux_nat_target::wait): Fix syntax error.
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
}
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);
target_bfd::~target_bfd ()
{
- gdb_bfd_unref (m_bfd);
xfree (m_table.sections);
}