aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-05-11 12:36:19 -0600
committerTom Tromey <tom@tromey.com>2018-05-16 11:45:03 -0600
commit06333fea767dc1eaf88ac286293fcbaa0ef2de9e (patch)
tree69d1ea0454bb40bd7407c990c8edc203fd9d7b58 /gdb/corelow.c
parentUse a distinguishing name for minidebug objfile (diff)
downloadbinutils-gdb-06333fea767dc1eaf88ac286293fcbaa0ef2de9e.tar.gz
binutils-gdb-06333fea767dc1eaf88ac286293fcbaa0ef2de9e.tar.bz2
binutils-gdb-06333fea767dc1eaf88ac286293fcbaa0ef2de9e.zip
Make "cbfd" a gdb_bfd_ref_ptr
This changes program_space::cbfd to be a gdb_bfd_ref_ptr. This makes it somewhat less error-prone to use, because now it manages the reference counting automatically. Tested by the buildbot. 2018-05-16 Tom Tromey <tom@tromey.com> * gdbcore.h (core_bfd): Redefine. * corelow.c (core_target::close): Update. (core_target_open): Update. * progspace.h (struct program_space) <cbfd>: Now a gdb_bfd_ref_ptr.
Diffstat (limited to 'gdb/corelow.c')
-rw-r--r--gdb/corelow.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 439fe1338a7..c6175279da9 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -270,8 +270,7 @@ core_target::close ()
comments in clear_solib in solib.c. */
clear_solib ();
- gdb_bfd_unref (core_bfd);
- core_bfd = NULL;
+ current_program_space->cbfd.reset (nullptr);
}
/* Core targets are heap-allocated (see core_target_open), so here
@@ -406,7 +405,7 @@ core_target_open (const char *arg, int from_tty)
filename.get (), bfd_errmsg (bfd_get_error ()));
}
- core_bfd = temp_bfd.release ();
+ current_program_space->cbfd = std::move (temp_bfd);
core_target *target = new core_target ();