Change program_space::ebfd to a gdb_bfd_ref_ptr

This changes program_space::ebfd to a gdb_bfd_ref_ptr, removing some
manual management.

gdb/ChangeLog
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.
This commit is contained in:
Tom Tromey 2020-10-29 15:04:33 -06:00
parent 7e10abd146
commit 19f6550ebb
4 changed files with 16 additions and 9 deletions

View file

@ -228,13 +228,11 @@ program_space::solibs () const
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);