Don't set gdb,noinferiorio on gdbserver boards
[external/binutils.git] / gdb / objfiles.c
index cbe1b8c..c6f9f00 100644 (file)
@@ -1,6 +1,6 @@
 /* GDB routines for manipulating objfiles.
 
-   Copyright (C) 1992-2014 Free Software Foundation, Inc.
+   Copyright (C) 1992-2015 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
@@ -301,7 +301,8 @@ allocate_objfile (bfd *abfd, const char *name, int flags)
       gdb_assert ((flags & OBJF_NOT_FILENAME) != 0);
       expanded_name = xstrdup ("<<anonymous objfile>>");
     }
-  else if ((flags & OBJF_NOT_FILENAME) != 0)
+  else if ((flags & OBJF_NOT_FILENAME) != 0
+          || is_target_filename (name))
     expanded_name = xstrdup (name);
   else
     expanded_name = gdb_abspath (name);
@@ -314,10 +315,6 @@ allocate_objfile (bfd *abfd, const char *name, int flags)
      that any data that is reference is saved in the per-objfile data
      region.  */
 
-  /* Update the per-objfile information that comes from the bfd, ensuring
-     that any data that is reference is saved in the per-objfile data
-     region.  */
-
   objfile->obfd = abfd;
   gdb_bfd_ref (abfd);
   if (abfd != NULL)
@@ -740,12 +737,12 @@ objfile_relocate1 (struct objfile *objfile,
 
   /* OK, get all the symtabs.  */
   {
+    struct compunit_symtab *cust;
     struct symtab *s;
 
-    ALL_OBJFILE_SYMTABS (objfile, s)
+    ALL_OBJFILE_FILETABS (objfile, cust, s)
     {
       struct linetable *l;
-      const struct blockvector *bv;
       int i;
 
       /* First the line table.  */
@@ -753,17 +750,20 @@ objfile_relocate1 (struct objfile *objfile,
       if (l)
        {
          for (i = 0; i < l->nitems; ++i)
-           l->item[i].pc += ANOFFSET (delta, s->block_line_section);
+           l->item[i].pc += ANOFFSET (delta,
+                                      COMPUNIT_BLOCK_LINE_SECTION
+                                        (cust));
        }
+    }
 
-      /* Don't relocate a shared blockvector more than once.  */
-      if (!s->primary)
-       continue;
+    ALL_OBJFILE_COMPUNITS (objfile, cust)
+    {
+      const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
+      int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
 
-      bv = SYMTAB_BLOCKVECTOR (s);
       if (BLOCKVECTOR_MAP (bv))
        addrmap_relocate (BLOCKVECTOR_MAP (bv),
-                         ANOFFSET (delta, s->block_line_section));
+                         ANOFFSET (delta, block_line_section));
 
       for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
        {
@@ -772,8 +772,8 @@ objfile_relocate1 (struct objfile *objfile,
          struct dict_iterator iter;
 
          b = BLOCKVECTOR_BLOCK (bv, i);
-         BLOCK_START (b) += ANOFFSET (delta, s->block_line_section);
-         BLOCK_END (b) += ANOFFSET (delta, s->block_line_section);
+         BLOCK_START (b) += ANOFFSET (delta, block_line_section);
+         BLOCK_END (b) += ANOFFSET (delta, block_line_section);
 
          /* We only want to iterate over the local symbols, not any
             symbols in included symtabs.  */
@@ -939,7 +939,7 @@ objfile_has_partial_symbols (struct objfile *objfile)
 int
 objfile_has_full_symbols (struct objfile *objfile)
 {
-  return objfile->symtabs != NULL;
+  return objfile->compunit_symtabs != NULL;
 }
 
 /* Return non-zero if OBJFILE has full or partial symbols, either directly
@@ -1493,7 +1493,7 @@ default_iterate_over_objfiles_in_search_order
     }
 }
 
-/* Return canonical name for OBJFILE.  */
+/* See objfiles.h.  */
 
 const char *
 objfile_name (const struct objfile *objfile)
@@ -1504,6 +1504,25 @@ objfile_name (const struct objfile *objfile)
   return objfile->original_name;
 }
 
+/* See objfiles.h.  */
+
+const char *
+objfile_filename (const struct objfile *objfile)
+{
+  if (objfile->obfd != NULL)
+    return bfd_get_filename (objfile->obfd);
+
+  return NULL;
+}
+
+/* See objfiles.h.  */
+
+const char *
+objfile_debug_name (const struct objfile *objfile)
+{
+  return lbasename (objfile->original_name);
+}
+
 /* Provide a prototype to silence -Wmissing-prototypes.  */
 extern initialize_file_ftype _initialize_objfiles;