Don't suppress errors inserting/removing hardware breakpoints in shared
[deliverable/binutils-gdb.git] / gdb / objfiles.c
index 73847bdf64b18faff1dbbc9971d550bfd0f0d518..e212c7055c6ed60afd72cddff698d13f4b653b00 100644 (file)
@@ -102,7 +102,7 @@ get_objfile_pspace_data (struct program_space *pspace)
   info = program_space_data (pspace, objfiles_pspace_data);
   if (info == NULL)
     {
-      info = XZALLOC (struct objfile_pspace_info);
+      info = XCNEW (struct objfile_pspace_info);
       set_program_space_data (pspace, objfiles_pspace_data, info);
     }
 
@@ -152,6 +152,7 @@ get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd)
       obstack_init (&storage->storage_obstack);
       storage->filename_cache = bcache_xmalloc (NULL, NULL);
       storage->macro_cache = bcache_xmalloc (NULL, NULL);
+      storage->language_of_main = language_unknown;
     }
 
   return storage;
@@ -186,6 +187,20 @@ set_objfile_per_bfd (struct objfile *objfile)
   objfile->per_bfd = get_objfile_bfd_data (objfile, objfile->obfd);
 }
 
+/* Set the objfile's per-BFD notion of the "main" name and
+   language.  */
+
+void
+set_objfile_main_name (struct objfile *objfile,
+                      const char *name, enum language lang)
+{
+  if (objfile->per_bfd->name_of_main == NULL
+      || strcmp (objfile->per_bfd->name_of_main, name) != 0)
+    objfile->per_bfd->name_of_main
+      = obstack_copy0 (&objfile->per_bfd->storage_obstack, name, strlen (name));
+  objfile->per_bfd->language_of_main = lang;
+}
+
 \f
 
 /* Called via bfd_map_over_sections to build up the section table that
@@ -279,7 +294,6 @@ allocate_objfile (bfd *abfd, const char *name, int flags)
   /* We could use obstack_specify_allocation here instead, but
      gdb_obstack.h specifies the alloc/dealloc functions.  */
   obstack_init (&objfile->objfile_obstack);
-  terminate_minimal_symbol_table (objfile);
 
   objfile_alloc_data (objfile);
 
@@ -319,6 +333,8 @@ allocate_objfile (bfd *abfd, const char *name, int flags)
   objfile->per_bfd = get_objfile_bfd_data (objfile, abfd);
   objfile->pspace = current_program_space;
 
+  terminate_minimal_symbol_table (objfile);
+
   /* Initialize the section indexes for this objfile, so that we can
      later detect if they are used w/o being properly assigned to.  */
 
@@ -364,10 +380,12 @@ get_objfile_arch (struct objfile *objfile)
 int
 entry_point_address_query (CORE_ADDR *entry_p)
 {
-  if (symfile_objfile == NULL || !symfile_objfile->ei.entry_point_p)
+  if (symfile_objfile == NULL || !symfile_objfile->per_bfd->ei.entry_point_p)
     return 0;
 
-  *entry_p = symfile_objfile->ei.entry_point;
+  *entry_p = (symfile_objfile->per_bfd->ei.entry_point
+             + ANOFFSET (symfile_objfile->section_offsets,
+                         symfile_objfile->per_bfd->ei.the_bfd_section_index));
 
   return 1;
 }
@@ -783,33 +801,6 @@ objfile_relocate1 (struct objfile *objfile,
   if (objfile->sf)
     objfile->sf->qf->relocate (objfile, new_offsets, delta);
 
-  {
-    struct minimal_symbol *msym;
-
-    ALL_OBJFILE_MSYMBOLS (objfile, msym)
-      if (SYMBOL_SECTION (msym) >= 0)
-      SYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, SYMBOL_SECTION (msym));
-  }
-  /* Relocating different sections by different amounts may cause the symbols
-     to be out of order.  */
-  msymbols_sort (objfile);
-
-  if (objfile->ei.entry_point_p)
-    {
-      /* Relocate ei.entry_point with its section offset, use SECT_OFF_TEXT
-        only as a fallback.  */
-      struct obj_section *s;
-      s = find_pc_section (objfile->ei.entry_point);
-      if (s)
-       {
-         int idx = gdb_bfd_section_index (objfile->obfd, s->the_bfd_section);
-
-         objfile->ei.entry_point += ANOFFSET (delta, idx);
-       }
-      else
-        objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
-    }
-
   {
     int i;
 
@@ -829,11 +820,6 @@ objfile_relocate1 (struct objfile *objfile,
                                obj_section_addr (s));
     }
 
-  /* Relocating probes.  */
-  if (objfile->sf && objfile->sf->sym_probe_fns)
-    objfile->sf->sym_probe_fns->sym_relocate_probe (objfile,
-                                                   new_offsets, delta);
-
   /* Data changed.  */
   return 1;
 }
@@ -1039,7 +1025,7 @@ have_minimal_symbols (void)
 
   ALL_OBJFILES (ofp)
   {
-    if (ofp->minimal_symbol_count > 0)
+    if (ofp->per_bfd->minimal_symbol_count > 0)
       {
        return 1;
       }
This page took 0.041414 seconds and 4 git commands to generate.