aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index 90439ba..7b9f473 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -46,6 +46,7 @@
#include "solib.h"
#include "interps.h"
#include "filesystem.h"
+#include "gdb_bfd.h"
/* Architecture-specific operations. */
@@ -389,7 +390,7 @@ solib_bfd_fopen (char *pathname, int fd)
pathname, bfd_errmsg (bfd_get_error ()));
}
- return abfd;
+ return gdb_bfd_ref (abfd);
}
/* Find shared library PATHNAME and open a BFD for it. */
@@ -420,7 +421,7 @@ solib_bfd_open (char *pathname)
/* Check bfd format. */
if (!bfd_check_format (abfd, bfd_object))
{
- bfd_close (abfd);
+ gdb_bfd_unref (abfd);
make_cleanup (xfree, found_pathname);
error (_("`%s': not in executable format: %s"),
found_pathname, bfd_errmsg (bfd_get_error ()));
@@ -466,7 +467,7 @@ solib_map_sections (struct so_list *so)
return 0;
/* Leave bfd open, core_xfer_memory and "info files" need it. */
- so->abfd = gdb_bfd_ref (abfd);
+ so->abfd = abfd;
/* copy full path name into so_name, so that later symbol_file_add
can find it. */
@@ -608,7 +609,7 @@ solib_read_symbols (struct so_list *so, int flags)
sap = build_section_addr_info_from_section_table (so->sections,
so->sections_end);
- so->objfile = symbol_file_add_from_bfd (so->abfd,
+ so->objfile = symbol_file_add_from_bfd (gdb_bfd_ref (so->abfd),
flags, sap, OBJF_SHARED,
NULL);
so->objfile->addr_low = so->addr_low;
@@ -1233,7 +1234,7 @@ reload_shared_libraries_1 (int from_tty)
{
found_pathname = xstrdup (bfd_get_filename (abfd));
make_cleanup (xfree, found_pathname);
- gdb_bfd_close_or_warn (abfd);
+ gdb_bfd_unref (abfd);
}
/* If this shared library is no longer associated with its previous