Default gdb_bfd_open's fd parameter to -1
authorPedro Alves <palves@redhat.com>
Tue, 19 May 2020 17:36:24 +0000 (18:36 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 19 May 2020 17:36:24 +0000 (18:36 +0100)
A following patch will add one more defaulted parameter.

gdb/ChangeLog:
2020-05-19  Pedro Alves  <palves@redhat.com>

* gdb_bfd.h: (gdb_bfd_open): Default to 'fd' parameter to -1.
Adjust all callers.

gdb/ChangeLog
gdb/build-id.c
gdb/compile/compile-object-load.c
gdb/dwarf2/read.c
gdb/gdb_bfd.h
gdb/machoread.c
gdb/solib-darwin.c
gdb/symfile.c
gdb/windows-nat.c
gdb/windows-tdep.c

index c4393182dd95bb4f085b6c4430793938ab4c8c40..a03be4339748a10e37bed57621ac3fb456631893 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-19  Pedro Alves  <palves@redhat.com>
+
+       * gdb_bfd.h: (gdb_bfd_open): Default to 'fd' parameter to -1.
+       Adjust all callers.
+
 2020-05-19  Yoshinori Sato  <ysato@users.sourceforge.jp>
 
        * h8300-tdep.c (h8300_is_argument_spill): Change how we check
index 6e1f8b0f0cc56d45b2f409d8f26116eb6f9a4a4b..2f1afbd8e18a8810ac986ea2d75739fa9d9329eb 100644 (file)
@@ -94,7 +94,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
     }
 
   /* We expect to be silent on the non-existing files.  */
-  gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
+  gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget);
 
   if (debug_bfd == NULL)
     {
index 55a46a31dba3a31b0b2bf3401f22d1b13d6836f4..76a9418dac0e6b5c99e69383105770f6a0025488 100644 (file)
@@ -604,7 +604,7 @@ compile_object_load (const compile_file_names &file_names,
   gdb::unique_xmalloc_ptr<char> filename
     (tilde_expand (file_names.object_file ()));
 
-  gdb_bfd_ref_ptr abfd (gdb_bfd_open (filename.get (), gnutarget, -1));
+  gdb_bfd_ref_ptr abfd (gdb_bfd_open (filename.get (), gnutarget));
   if (abfd == NULL)
     error (_("\"%s\": could not open as compiled module: %s"),
           filename.get (), bfd_errmsg (bfd_get_error ()));
index 719051bc5b2fa264afd659ef5071ac5805826754..0c6182bbf3b92fe4ce396d073d800c966d35d61a 100644 (file)
@@ -2115,7 +2115,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile)
 
   /* First try the file name given in the section.  If that doesn't
      work, try to use the build-id instead.  */
-  gdb_bfd_ref_ptr dwz_bfd (gdb_bfd_open (filename, gnutarget, -1));
+  gdb_bfd_ref_ptr dwz_bfd (gdb_bfd_open (filename, gnutarget));
   if (dwz_bfd != NULL)
     {
       if (!build_id_verify (dwz_bfd.get (), buildid_len, buildid))
@@ -2138,7 +2138,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile)
       if (fd.get () >= 0)
        {
          /* File successfully retrieved from server.  */
-         dwz_bfd = gdb_bfd_open (alt_filename.get (), gnutarget, -1);
+         dwz_bfd = gdb_bfd_open (alt_filename.get (), gnutarget);
 
          if (dwz_bfd == nullptr)
            warning (_("File \"%s\" from debuginfod cannot be opened as bfd"),
index ce72f78a23f3d77c655a8db69f2f40763d5b70ce..532520e0f7d29624cf3838c1d7a2a57e1fa431bf 100644 (file)
@@ -80,7 +80,8 @@ typedef gdb::ref_ptr<struct bfd, gdb_bfd_ref_policy> gdb_bfd_ref_ptr;
    bfd_get_filename will not be exactly NAME but rather NAME with
    TARGET_SYSROOT_PREFIX stripped.  */
 
-gdb_bfd_ref_ptr gdb_bfd_open (const char *name, const char *target, int fd);
+gdb_bfd_ref_ptr gdb_bfd_open (const char *name, const char *target,
+                             int fd = -1);
 
 /* Mark the CHILD BFD as being a member of PARENT.  Also, increment
    the reference count of CHILD.  Calling this function ensures that
index 4655b67f118c770c69565b3c8f10bd10f1ca37d2..fb4e205088a447d48f69485f22e349b63d3914bf 100644 (file)
@@ -639,7 +639,7 @@ macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr,
 
          /* Open the archive and check the format.  */
          gdb_bfd_ref_ptr archive_bfd (gdb_bfd_open (archive_name.c_str (),
-                                                    gnutarget, -1));
+                                                    gnutarget));
          if (archive_bfd == NULL)
            {
              warning (_("Could not open OSO archive file \"%s\""),
@@ -705,7 +705,7 @@ macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr,
        }
       else
        {
-         gdb_bfd_ref_ptr abfd (gdb_bfd_open (oso->name, gnutarget, -1));
+         gdb_bfd_ref_ptr abfd (gdb_bfd_open (oso->name, gnutarget));
          if (abfd == NULL)
             warning (_("`%s': can't open to read symbols: %s."), oso->name,
                      bfd_errmsg (bfd_get_error ()));
index 03d91d1690a2fd154eb46e2721901b220f54f9dd..e740a41fa4f6d0d67a5bfe81af66ce8a037cd439 100644 (file)
@@ -436,7 +436,7 @@ darwin_get_dyld_bfd ()
     return NULL;
 
   /* Create a bfd for the interpreter.  */
-  gdb_bfd_ref_ptr dyld_bfd (gdb_bfd_open (interp_name, gnutarget, -1));
+  gdb_bfd_ref_ptr dyld_bfd (gdb_bfd_open (interp_name, gnutarget));
   if (dyld_bfd != NULL)
     {
       gdb_bfd_ref_ptr sub
index e6ec458504af9d7aa639d5a9a90a234e5af5e4fc..01e0726e1eb409cf812827b297502099ddd8dc71 100644 (file)
@@ -1275,7 +1275,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
       gdb_flush (gdb_stdout);
     }
 
-  gdb_bfd_ref_ptr abfd (gdb_bfd_open (name.c_str (), gnutarget, -1));
+  gdb_bfd_ref_ptr abfd (gdb_bfd_open (name.c_str (), gnutarget));
 
   if (abfd == NULL)
     {
@@ -2039,7 +2039,7 @@ generic_load (const char *args, int from_tty)
     }
 
   /* Open the file for loading.  */
-  gdb_bfd_ref_ptr loadfile_bfd (gdb_bfd_open (filename.get (), gnutarget, -1));
+  gdb_bfd_ref_ptr loadfile_bfd (gdb_bfd_open (filename.get (), gnutarget));
   if (loadfile_bfd == NULL)
     perror_with_name (filename.get ());
 
@@ -2524,7 +2524,7 @@ reread_symbols (void)
            obfd_filename = bfd_get_filename (objfile->obfd);
            /* Open the new BFD before freeing the old one, so that
               the filename remains live.  */
-           gdb_bfd_ref_ptr temp (gdb_bfd_open (obfd_filename, gnutarget, -1));
+           gdb_bfd_ref_ptr temp (gdb_bfd_open (obfd_filename, gnutarget));
            objfile->obfd = temp.release ();
            if (objfile->obfd == NULL)
              error (_("Can't open %s to read symbols."), obfd_filename);
index f52af9a12747aba5b4abd990d4345139c57be9ee..3452f6c827f45bc40361bbf72d97d911eac4823c 100644 (file)
@@ -834,7 +834,7 @@ windows_make_so (const char *name, LPVOID load_addr)
     {
       asection *text = NULL;
 
-      gdb_bfd_ref_ptr abfd (gdb_bfd_open (so->so_name, "pei-i386", -1));
+      gdb_bfd_ref_ptr abfd (gdb_bfd_open (so->so_name, "pei-i386"));
 
       if (abfd == NULL)
        return so;
index 086038af0d49817061dbd03f4141888c966a63f2..20a18e6b68398163daebcf4cb8b425a25abe3d9d 100644 (file)
@@ -537,7 +537,7 @@ windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
 
   if (!text_offset)
     {
-      gdb_bfd_ref_ptr dll (gdb_bfd_open (so_name, gnutarget, -1));
+      gdb_bfd_ref_ptr dll (gdb_bfd_open (so_name, gnutarget));
       /* The following calls are OK even if dll is NULL.
         The default value 0x1000 is returned by pe_text_section_offset
         in that case.  */
This page took 0.03852 seconds and 4 git commands to generate.