* cli/cli-dump.c (bfd_openr_with_cleanup): Use gdb_bfd_openr.

(bfd_openw_with_cleanup): Use gdb_bfd_openw.
	* corelow.c (core_open): Use gdb_bfd_fopen.
	* dsrec.c (load_srec): Use gdb_bfd_openr.
	* exec.c (exec_file_attach): Use gdb_bfd_fopen.
	* gcore.c (gcore_memory_sections): Use gdb_bfd_openw.
	* gdb_bfd.c (gdb_bfd_fopen, gdb_bfd_openr, gdb_bfd_openw)
	(gdb_bfd_openr_iovec, gdb_bfd_openr_next_archived_file)
	(gdb_bfd_fdopenr): New functions.
	* gdb_bfd.h (gdb_bfd_fopen, gdb_bfd_openr, gdb_bfd_openw)
	(gdb_bfd_openr_iovec, gdb_bfd_openr_next_archived_file)
	(gdb_bfd_fdopenr): Declare.
	* jit.c (bfd_open_from_target_memory): Use gdb_bfd_openr_iovec.
	* m32-rom.c (m32r_load, m32r_upload_command): Use gdb_bfd_openr.
	* machoread.c (macho_symfile_read_all_oso): Use gdb_bfd_openr,
	gdb_bfd_openr_next_archived_file.
	(macho_check_dsym): Use gdb_bfd_openr.
	(macho_add_oso_symfile): Don't call gdb_bfd_stash_filename.
	* procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_fdopenr.
	* remote-m32r-sdi.c (m32r_load): Use gdb_bfd_openr.
	* remote-mips.c (mips_load_srec, pmon_load_fast): Use
	gdb_bfd_openr.
	* remote.c (remote_bfd_open): Use gdb_bfd_openr_iovec.
	* rs6000-nat.c (add_vmap): Use gdb_bfd_openr, gdb_bfd_fdopenr,
	gdb_bfd_openr_next_archived_file.
	* solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
	Use gdb_bfd_openr.
	* solib-pa64.c (pa64_solib_create_inferior_hook): Use
	gdb_bfd_openr.
	* solib-spu.c (spu_bfd_fopen): Use gdb_bfd_openr_iovec.
	* solib.c (solib_bfd_fopen): Use gdb_bfd_fopen.
	* spu-linux-nat.c (spu_bfd_open): Use gdb_bfd_openr_iovec.
	* symfile.c (bfd_open_maybe_remote): Use gdb_bfd_openr.
	(symfile_bfd_open): Use gdb_bfd_fopen.
	(generic_load): Use gdb_bfd_openr.
	* windows-nat.c (windows_make_so): Use gdb_bfd_openr.
This commit is contained in:
Tom Tromey 2012-07-23 14:57:58 +00:00
parent 520b0001c1
commit 64c311498e
23 changed files with 249 additions and 105 deletions

View file

@ -1702,13 +1702,8 @@ bfd_open_maybe_remote (const char *name)
if (remote_filename_p (name))
result = remote_bfd_open (name, gnutarget);
else
{
result = bfd_openr (name, gnutarget);
if (result != NULL)
gdb_bfd_stash_filename (result);
}
result = gdb_bfd_openr (name, gnutarget);
gdb_bfd_ref (result);
return result;
}
@ -1728,7 +1723,6 @@ symfile_bfd_open (char *name)
if (remote_filename_p (name))
{
sym_bfd = remote_bfd_open (name, gnutarget);
gdb_bfd_ref (sym_bfd);
if (!sym_bfd)
error (_("`%s': can't open to read symbols: %s."), name,
bfd_errmsg (bfd_get_error ()));
@ -1768,8 +1762,7 @@ symfile_bfd_open (char *name)
name = absolute_name;
make_cleanup (xfree, name);
sym_bfd = bfd_fopen (name, gnutarget, FOPEN_RB, desc);
gdb_bfd_ref (sym_bfd);
sym_bfd = gdb_bfd_fopen (name, gnutarget, FOPEN_RB, desc);
if (!sym_bfd)
{
make_cleanup (xfree, name);
@ -1785,8 +1778,6 @@ symfile_bfd_open (char *name)
bfd_errmsg (bfd_get_error ()));
}
gdb_bfd_stash_filename (sym_bfd);
return sym_bfd;
}
@ -2111,8 +2102,7 @@ generic_load (char *args, int from_tty)
}
/* Open the file for loading. */
loadfile_bfd = bfd_openr (filename, gnutarget);
gdb_bfd_ref (loadfile_bfd);
loadfile_bfd = gdb_bfd_openr (filename, gnutarget);
if (loadfile_bfd == NULL)
{
perror_with_name (filename);