* windows-nat.c (windows_make_so): Use gdb_bfd_open.

* symfile.c (bfd_open_maybe_remote): Use gdb_bfd_open.
	(symfile_bfd_open): Likewise.
	(generic_load): Likewise.
	* solib.c (solib_bfd_fopen): Use gdb_bfd_open.
	* solib-pa64.c (pa64_solib_create_inferior_hook): Use
	gdb_bfd_open.
	* solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
	Use gdb_bfd_open.
	* rs6000-nat.c (add_vmap): Use gdb_bfd_open.
	* remote-mips.c (mips_load_srec): Use gdb_bfd_open.
	(pmon_load_fast): Likewise.
	* remote-m32r-sdi.c (m32r_load): Use gdb_bfd_open.
	* procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_open.
	* machoread.c (macho_symfile_read_all_oso): Use gdb_bfd_open.
	(macho_check_dsym): Likewise.
	* m32r-rom.c (m32r_load): Use gdb_bfd_open.
	(m32r_upload_command): Likewise.
	* gdb_bfd.h (gdb_bfd_cache): Declare.
	* gdb_bfd.c (struct gdb_bfd_data): New.
	(gdb_bfd_cache): New global.
	(struct gdb_bfd_cache_search): New.
	(hash_bfd): New function.
	(eq_bfd): Likewise.
	(gdb_bfd_open): Likewise.
	(gdb_bfd_ref): Allocate a gdb_bfd_data and attach to the BFD.
	(gdb_bfd_unref): Remove closed BFD from cache.  Update for
	gdb_bfd_data.
	* exec.c (exec_file_attach): Use gdb_bfd_open.
	* dsrec.c (load_srec): Use gdb_bfd_open.
This commit is contained in:
Tom Tromey 2012-08-22 16:24:39 +00:00
parent 6532ff3697
commit 1c00ec6b06
13 changed files with 54 additions and 24 deletions

View File

@ -1,3 +1,36 @@
2012-08-22 Tom Tromey <tromey@redhat.com>
* windows-nat.c (windows_make_so): Use gdb_bfd_open.
* symfile.c (bfd_open_maybe_remote): Use gdb_bfd_open.
(symfile_bfd_open): Likewise.
(generic_load): Likewise.
* solib.c (solib_bfd_fopen): Use gdb_bfd_open.
* solib-pa64.c (pa64_solib_create_inferior_hook): Use
gdb_bfd_open.
* solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
Use gdb_bfd_open.
* rs6000-nat.c (add_vmap): Use gdb_bfd_open.
* remote-mips.c (mips_load_srec): Use gdb_bfd_open.
(pmon_load_fast): Likewise.
* remote-m32r-sdi.c (m32r_load): Use gdb_bfd_open.
* procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_open.
* machoread.c (macho_symfile_read_all_oso): Use gdb_bfd_open.
(macho_check_dsym): Likewise.
* m32r-rom.c (m32r_load): Use gdb_bfd_open.
(m32r_upload_command): Likewise.
* gdb_bfd.h (gdb_bfd_cache): Declare.
* gdb_bfd.c (struct gdb_bfd_data): New.
(gdb_bfd_cache): New global.
(struct gdb_bfd_cache_search): New.
(hash_bfd): New function.
(eq_bfd): Likewise.
(gdb_bfd_open): Likewise.
(gdb_bfd_ref): Allocate a gdb_bfd_data and attach to the BFD.
(gdb_bfd_unref): Remove closed BFD from cache. Update for
gdb_bfd_data.
* exec.c (exec_file_attach): Use gdb_bfd_open.
* dsrec.c (load_srec): Use gdb_bfd_open.
2012-08-22 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (macro_start_file): Update.

View File

@ -61,7 +61,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
srec = (char *) alloca (maxrecsize + 1);
abfd = gdb_bfd_openr (file, 0);
abfd = gdb_bfd_open (file, NULL, -1);
if (!abfd)
{
printf_filtered (_("Unable to open file %s\n"), file);

View File

@ -230,9 +230,11 @@ exec_file_attach (char *filename, int from_tty)
if (scratch_chan < 0)
perror_with_name (filename);
exec_bfd = gdb_bfd_fopen (scratch_pathname, gnutarget,
write_files ? FOPEN_RUB : FOPEN_RB,
scratch_chan);
if (write_files)
exec_bfd = gdb_bfd_fopen (scratch_pathname, gnutarget,
FOPEN_RUB, scratch_chan);
else
exec_bfd = gdb_bfd_open (scratch_pathname, gnutarget, scratch_chan);
if (!exec_bfd)
{

View File

@ -130,7 +130,7 @@ m32r_load (char *filename, int from_tty)
if (filename == NULL || filename[0] == 0)
filename = get_exec_file (1);
abfd = gdb_bfd_openr (filename, 0);
abfd = gdb_bfd_open (filename, NULL, -1);
if (!abfd)
error (_("Unable to open file %s."), filename);
cleanup = make_cleanup_bfd_unref (abfd);
@ -529,7 +529,7 @@ m32r_upload_command (char *args, int from_tty)
printf_filtered (" -- Ethernet load complete.\n");
gettimeofday (&end_time, NULL);
abfd = gdb_bfd_openr (args, 0);
abfd = gdb_bfd_open (args, NULL, -1);
cleanup = make_cleanup_bfd_unref (abfd);
if (abfd != NULL)
{ /* Download is done -- print section statistics. */

View File

@ -688,7 +688,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
}
/* Open the archive and check the format. */
archive_bfd = gdb_bfd_openr (archive_name, gnutarget);
archive_bfd = gdb_bfd_open (archive_name, gnutarget, -1);
if (archive_bfd == NULL)
{
warning (_("Could not open OSO archive file \"%s\""),
@ -762,7 +762,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
{
bfd *abfd;
abfd = gdb_bfd_openr (oso->name, gnutarget);
abfd = gdb_bfd_open (oso->name, gnutarget, -1);
if (!abfd)
warning (_("`%s': can't open to read symbols: %s."), oso->name,
bfd_errmsg (bfd_get_error ()));

View File

@ -1258,7 +1258,7 @@ m32r_load (char *args, int from_tty)
if (!filename)
filename = get_exec_file (1);
pbfd = gdb_bfd_openr (filename, gnutarget);
pbfd = gdb_bfd_open (filename, gnutarget, -1);
if (pbfd == NULL)
{
perror_with_name (filename);

View File

@ -2789,7 +2789,7 @@ mips_load_srec (char *args)
buffer = alloca (srec_frame * 2 + 256);
abfd = gdb_bfd_openr (args, 0);
abfd = gdb_bfd_open (args, NULL, -1);
if (!abfd)
{
printf_filtered ("Unable to open file %s\n", args);
@ -3376,7 +3376,7 @@ pmon_load_fast (char *file)
buffer = (char *) xmalloc (MAXRECSIZE + 1);
binbuf = (unsigned char *) xmalloc (BINCHUNK);
abfd = gdb_bfd_openr (file, 0);
abfd = gdb_bfd_open (file, NULL, -1);
if (!abfd)
{
printf_filtered ("Unable to open file %s\n", file);

View File

@ -745,12 +745,7 @@ add_vmap (LdInfo *ldi)
mem = xstrdup (mem);
fd = LDI_FD (ldi, arch64);
if (fd < 0)
/* Note that this opens it once for every member; a possible
enhancement would be to only open it once for every object. */
abfd = gdb_bfd_openr (filename, gnutarget);
else
abfd = gdb_bfd_fdopenr (filename, gnutarget, fd);
abfd = gdb_bfd_open (filename, gnutarget, fd < 0 ? -1 : fd);
if (!abfd)
{
warning (_("Could not open `%s' as an executable file: %s"),

View File

@ -371,7 +371,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
cleanup = make_cleanup (null_cleanup, NULL);
/* Create a bfd for the interpreter. */
dyld_bfd = gdb_bfd_openr (interp_name, gnutarget);
dyld_bfd = gdb_bfd_open (interp_name, gnutarget, -1);
if (dyld_bfd)
{
bfd *sub;

View File

@ -362,7 +362,7 @@ manpage for methods to privately map shared library text."));
to find any magic formula to find it for Solaris (appears to
be trivial on GNU/Linux). Therefore, we have to try an alternate
mechanism to find the dynamic linker's base address. */
tmp_bfd = gdb_bfd_openr (buf, gnutarget);
tmp_bfd = gdb_bfd_open (buf, gnutarget, -1);
if (tmp_bfd == NULL)
return;

View File

@ -377,7 +377,7 @@ solib_bfd_fopen (char *pathname, int fd)
}
else
{
abfd = gdb_bfd_fopen (pathname, gnutarget, FOPEN_RB, fd);
abfd = gdb_bfd_open (pathname, gnutarget, fd);
if (abfd)
bfd_set_cacheable (abfd, 1);

View File

@ -1703,7 +1703,7 @@ gdb_bfd_open_maybe_remote (const char *name)
if (remote_filename_p (name))
result = remote_bfd_open (name, gnutarget);
else
result = gdb_bfd_openr (name, gnutarget);
result = gdb_bfd_open (name, gnutarget, -1);
return result;
}
@ -1763,7 +1763,7 @@ symfile_bfd_open (char *name)
name = absolute_name;
make_cleanup (xfree, name);
sym_bfd = gdb_bfd_fopen (name, gnutarget, FOPEN_RB, desc);
sym_bfd = gdb_bfd_open (name, gnutarget, desc);
if (!sym_bfd)
{
make_cleanup (xfree, name);
@ -2103,7 +2103,7 @@ generic_load (char *args, int from_tty)
}
/* Open the file for loading. */
loadfile_bfd = gdb_bfd_openr (filename, gnutarget);
loadfile_bfd = gdb_bfd_open (filename, gnutarget, -1);
if (loadfile_bfd == NULL)
{
perror_with_name (filename);

View File

@ -752,7 +752,7 @@ windows_make_so (const char *name, LPVOID load_addr)
asection *text = NULL;
CORE_ADDR text_vma;
abfd = gdb_bfd_openr (so->so_name, "pei-i386");
abfd = gdb_bfd_open (so->so_name, "pei-i386", -1);
if (!abfd)
return so;