Automatic date update in version.in
[deliverable/binutils-gdb.git] / gdb / gdb_bfd.c
index b60d237635a124e5e5fd3bca112ec5b147f1181d..02b1375b8ac7d59efd5f4e024136cbea355b584e 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for BFD wrappers used by GDB.
 
-   Copyright (C) 2011-2017 Free Software Foundation, Inc.
+   Copyright (C) 2011-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -34,9 +34,6 @@
 #include "gdb/fileio.h"
 #include "inferior.h"
 
-typedef bfd *bfdp;
-DEF_VEC_P (bfdp);
-
 /* An object of this type is stored in the section's user data when
    mapping a section.  */
 
@@ -87,14 +84,6 @@ struct gdb_bfd_data
 
   ~gdb_bfd_data ()
   {
-    int ix;
-    bfd *included_bfd;
-
-    for (ix = 0;
-        VEC_iterate (bfdp, included_bfds, ix, included_bfd);
-        ++ix)
-      gdb_bfd_unref (included_bfd);
-    VEC_free (bfdp, included_bfds);
   }
 
   /* The reference count.  */
@@ -130,7 +119,7 @@ struct gdb_bfd_data
   bfd *archive_bfd = nullptr;
 
   /* Table of all the bfds this bfd has included.  */
-  VEC (bfdp) *included_bfds = nullptr;
+  std::vector<gdb_bfd_ref_ptr> included_bfds;
 
   /* The registry.  */
   REGISTRY_FIELDS = {};
@@ -713,9 +702,15 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
 
   data = NULL;
   if (!bfd_get_full_section_contents (abfd, sectp, &data))
-    error (_("Can't read data for section '%s' in file '%s'"),
-          bfd_get_section_name (abfd, sectp),
-          bfd_get_filename (abfd));
+    {
+      warning (_("Can't read data for section '%s' in file '%s'"),
+              bfd_get_section_name (abfd, sectp),
+              bfd_get_filename (abfd));
+      /* Set size to 0 to prevent further attempts to read the invalid
+        section.  */
+      *size = 0;
+      return (const gdb_byte *) NULL;
+    }
   descriptor->data = data;
 
  done:
@@ -875,9 +870,8 @@ gdb_bfd_record_inclusion (bfd *includer, bfd *includee)
 {
   struct gdb_bfd_data *gdata;
 
-  gdb_bfd_ref (includee);
   gdata = (struct gdb_bfd_data *) bfd_usrdata (includer);
-  VEC_safe_push (bfdp, gdata->included_bfds, includee);
+  gdata->included_bfds.push_back (new_bfd_ref (includee));
 }
 
 /* See gdb_bfd.h.  */
This page took 0.024255 seconds and 4 git commands to generate.