#include "solib.h"
#include "interps.h"
#include "filesystem.h"
+#include "gdb_bfd.h"
/* Architecture-specific operations. */
pathname, bfd_errmsg (bfd_get_error ()));
}
- return abfd;
+ return gdb_bfd_ref (abfd);
}
/* Find shared library PATHNAME and open a BFD for it. */
/* 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 ()));
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. */
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;
{
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