* windows-nat.c (windows_make_so): Use gdb_bfd_open.
authorTom Tromey <tromey@redhat.com>
Wed, 22 Aug 2012 16:24:39 +0000 (16:24 +0000)
committerTom Tromey <tromey@redhat.com>
Wed, 22 Aug 2012 16:24:39 +0000 (16:24 +0000)
* 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.

13 files changed:
gdb/ChangeLog
gdb/dsrec.c
gdb/exec.c
gdb/m32r-rom.c
gdb/machoread.c
gdb/remote-m32r-sdi.c
gdb/remote-mips.c
gdb/rs6000-nat.c
gdb/solib-darwin.c
gdb/solib-pa64.c
gdb/solib.c
gdb/symfile.c
gdb/windows-nat.c

index 571c9b6e3644d72478cd94c00a5b0cceec8b0edc..2f54efca05a3f27fa1c040409a74b9e5e8e1084e 100644 (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.
index f39d0ed5f392ca66d5e3c065bdf25747da9feb49..20ff33938587e941f443812839424a8d58c05e2f 100644 (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);
index de1b0b63b506ada094fe52d86424ed58fdcf6070..2bd31816f9a0229ec06871e326f31dc5d5af0096 100644 (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)
        {
index 9a2f5aa555f7fcaa383a58f08616f60b87430df1..4bb4cebde1489a9b55f96a6d3b139a3840525e49 100644 (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.  */
index 2c398fa264bfc5342dc0db4b6e02ebf1280df78f..6a6eaa1fa9d7f46583f1aad9ebeec963e7ddf624 100644 (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 ()));
index 85268b6ab1caaab008efb95712070d7fb0d1290e..748aeba6953bada41528a33ec5eb2f72e8613092 100644 (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);
index db4381b653003326822e31c8570bfa241b58874f..7219bc76be1860d1bda9b2c89d6bdba56a96c423 100644 (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);
index 9b8efd3fdca9e66833a9e64b361cf9887bced5f3..0ec04298d2be97beb7be5df7ecac98e17ff6f828 100644 (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"),
index d08bd387692fc5d0e1f5a668f749062046b45b95..55ecb91de0db2b74a4bd7cf6ff4d8c774e6c243f 100644 (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;
index 00ed8a549036a1f8c3a5344a7a38a2e5797cf4b7..d9f277fd9da9b900a03371303e3aec910d4749ff 100644 (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;
 
index 3081f35117d24a861e8f6826ee7d8ee3486f27f4..01573f87184517fe2db380b3e8345125a9d972a8 100644 (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);
index 6c93ba6dcdb27af235fd6d2454c54f4bd1e21345..7c202b5ae1b7a23b83bf97080ff10dd0f14539d4 100644 (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);
index afef61544a0b7316386d96d42e4d66517f2f8504..b3c4a8e5e8a4a5250dc1af234ed620dd3fec91df 100644 (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;
This page took 0.047815 seconds and 4 git commands to generate.