+2020-10-29 Tom Tromey <tom@tromey.com>
+
+ * exec.c (exec_file_attach): Update.
+ * progspace.c (program_space::exec_close): Update.
+ * progspace.h (struct program_space) <ebfd>: Now a
+ gdb_bfd_ref_ptr.
+ <set_exec_bfd>: Change argument type.
+ <exec_bfd>: Update.
+
2020-10-29 Tom Tromey <tom@tromey.com>
* windows-tdep.c (windows_solib_create_inferior_hook): Update.
FOPEN_RUB, scratch_chan);
else
temp = gdb_bfd_open (canonical_pathname, gnutarget, scratch_chan);
- current_program_space->set_exec_bfd (temp.release ());
+ current_program_space->set_exec_bfd (std::move (temp));
if (!current_program_space->exec_bfd ())
{
void
program_space::exec_close ()
{
- if (ebfd)
+ if (ebfd != nullptr)
{
- gdb_bfd_unref (ebfd);
-
/* Removing target sections may close the exec_ops target.
Clear ebfd before doing so to prevent recursion. */
- ebfd = NULL;
+ ebfd.reset (nullptr);
ebfd_mtime = 0;
remove_target_sections (&ebfd);
/* Return the exec BFD for this program space. */
bfd *exec_bfd () const
{
- return ebfd;
+ return ebfd.get ();
}
/* Set the exec BFD for this program space to ABFD. */
- void set_exec_bfd (bfd *abfd)
+ void set_exec_bfd (gdb_bfd_ref_ptr &&abfd)
{
- ebfd = abfd;
+ ebfd = std::move (abfd);
}
/* Unique ID number. */
managed by the exec target. */
/* The BFD handle for the main executable. */
- bfd *ebfd = NULL;
+ gdb_bfd_ref_ptr ebfd;
/* The last-modified time, from when the exec was brought in. */
long ebfd_mtime = 0;
/* Similar to bfd_get_filename (exec_bfd) but in original form given