target.c: Add a cast and change a type
[deliverable/binutils-gdb.git] / gdb / solib.c
index 01c66dba8e44c61500c5bfdaec904a1463e8adcb..ca2c9ab89c264e24101a1a7498ce2f9e6ace09ba 100644 (file)
@@ -65,7 +65,8 @@ solib_init (struct obstack *obstack)
 static const struct target_so_ops *
 solib_ops (struct gdbarch *gdbarch)
 {
-  const struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
+  const struct target_so_ops **ops
+    = (const struct target_so_ops **) gdbarch_data (gdbarch, solib_data);
 
   return *ops;
 }
@@ -75,7 +76,8 @@ solib_ops (struct gdbarch *gdbarch)
 void
 set_solib_ops (struct gdbarch *gdbarch, const struct target_so_ops *new_ops)
 {
-  const struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
+  const struct target_so_ops **ops
+    = (const struct target_so_ops **) gdbarch_data (gdbarch, solib_data);
 
   *ops = new_ops;
 }
@@ -192,7 +194,7 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
       char *p;
 
       /* Avoid clobbering our input.  */
-      p = alloca (strlen (in_pathname) + 1);
+      p = (char *) alloca (strlen (in_pathname) + 1);
       strcpy (p, in_pathname);
       in_pathname = p;
 
@@ -396,7 +398,7 @@ exec_file_find (char *in_pathname, int *fd)
        {
          char *new_pathname;
 
-         new_pathname = alloca (strlen (in_pathname) + 5);
+         new_pathname = (char *) alloca (strlen (in_pathname) + 5);
          strcpy (new_pathname, in_pathname);
          strcat (new_pathname, ".exe");
 
@@ -434,8 +436,9 @@ solib_find (char *in_pathname, int *fd)
        {
          char *new_pathname;
 
-         new_pathname = alloca (p - in_pathname + 1
-                                + strlen (solib_symbols_extension) + 1);
+         new_pathname
+           = (char *) alloca (p - in_pathname + 1
+                              + strlen (solib_symbols_extension) + 1);
          memcpy (new_pathname, in_pathname, p - in_pathname + 1);
          strcpy (new_pathname + (p - in_pathname) + 1,
                  solib_symbols_extension);
@@ -518,20 +521,6 @@ solib_bfd_open (char *pathname)
   return abfd;
 }
 
-/* Boolean for command 'set validate-build-id'.  */
-static int validate_build_id = 1;
-
-/* Implement 'show validate-build-id'.  */
-
-static void
-show_validate_build_id (struct ui_file *file, int from_tty,
-                       struct cmd_list_element *c, const char *value)
-{
-  fprintf_filtered (file, _("Validation a build-id matches to load a shared "
-                           "library is %s.\n"),
-                   value);
-}
-
 /* Given a pointer to one of the shared objects in our list of mapped
    objects, use the recorded name to open a bfd descriptor for the
    object, build a section table, relocate all the section addresses
@@ -548,7 +537,7 @@ static int
 solib_map_sections (struct so_list *so)
 {
   const struct target_so_ops *ops = solib_ops (target_gdbarch ());
-  char *filename, *validate_error;
+  char *filename;
   struct target_section *p;
   struct cleanup *old_chain;
   bfd *abfd;
@@ -564,29 +553,6 @@ solib_map_sections (struct so_list *so)
   /* Leave bfd open, core_xfer_memory and "info files" need it.  */
   so->abfd = abfd;
 
-  gdb_assert (ops->validate != NULL);
-
-  validate_error = ops->validate (so);
-  if (validate_error != NULL)
-    {
-      if (validate_build_id)
-       {
-         warning (_("Shared object \"%s\" could not be validated (%s) and "
-                    "will be ignored; "
-                    "or use 'set validate-build-id off'."),
-                  so->so_name, validate_error);
-         xfree (validate_error);
-         gdb_bfd_unref (so->abfd);
-         so->abfd = NULL;
-         return 0;
-       }
-      warning (_("Shared object \"%s\" could not be validated (%s) "
-                "but it is being loaded due to "
-                "'set validate-build-id off'."),
-              so->so_name, validate_error);
-      xfree (validate_error);
-    }
-
   /* Copy the full path name into so_name, allowing symbol_file_add
      to find it later.  This also affects the =library-loaded GDB/MI
      event, and in particular the part of that notification providing
@@ -663,9 +629,6 @@ clear_so (struct so_list *so)
      of the symbol file.  */
   strcpy (so->so_name, so->so_original_name);
 
-  xfree (so->build_id);
-  so->build_id = NULL;
-
   /* Do the same for target-specific data.  */
   if (ops->clear_so != NULL)
     ops->clear_so (so);
@@ -1551,16 +1514,16 @@ show_auto_solib_add (struct ui_file *file, int from_tty,
 /* Handler for library-specific lookup of global symbol NAME in OBJFILE.  Call
    the library-specific handler if it is installed for the current target.  */
 
-struct symbol *
+struct block_symbol
 solib_global_lookup (struct objfile *objfile,
                     const char *name,
                     const domain_enum domain)
 {
-  const struct target_so_ops *ops = solib_ops (get_objfile_arch (objfile));
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
   if (ops->lookup_lib_global_symbol != NULL)
     return ops->lookup_lib_global_symbol (objfile, name, domain);
-  return NULL;
+  return (struct block_symbol) {NULL, NULL};
 }
 
 /* Lookup the value for a specific symbol from dynamic symbol table.  Look
@@ -1570,8 +1533,9 @@ solib_global_lookup (struct objfile *objfile,
 
 CORE_ADDR
 gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
-                                  int (*match_sym) (asymbol *, void *),
-                                  void *data)
+                                  int (*match_sym) (const asymbol *,
+                                                    const void *),
+                                  const void *data)
 {
   long storage_needed = bfd_get_symtab_upper_bound (abfd);
   CORE_ADDR symaddr = 0;
@@ -1629,8 +1593,9 @@ gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
 
 static CORE_ADDR
 bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
-                                  int (*match_sym) (asymbol *, void *),
-                                  void *data)
+                                  int (*match_sym) (const asymbol *,
+                                                    const void *),
+                                  const void *data)
 {
   long storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
   CORE_ADDR symaddr = 0;
@@ -1667,8 +1632,8 @@ bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
 
 CORE_ADDR
 gdb_bfd_lookup_symbol (bfd *abfd,
-                      int (*match_sym) (asymbol *, void *),
-                      void *data)
+                      int (*match_sym) (const asymbol *, const void *),
+                      const void *data)
 {
   CORE_ADDR symaddr = gdb_bfd_lookup_symbol_from_symtab (abfd, match_sym, data);
 
@@ -1697,14 +1662,6 @@ remove_user_added_objfile (struct objfile *objfile)
     }
 }
 
-/* Default implementation does not perform any validation.  */
-
-char *
-default_solib_validate (const struct so_list *const so)
-{
-  return NULL; /* No validation.  */
-}
-
 extern initialize_file_ftype _initialize_solib; /* -Wmissing-prototypes */
 
 void
@@ -1762,18 +1719,4 @@ PATH and LD_LIBRARY_PATH."),
                                     reload_shared_libraries,
                                     show_solib_search_path,
                                     &setlist, &showlist);
-
-  add_setshow_boolean_cmd ("validate-build-id", class_support,
-                          &validate_build_id, _("\
-Set validation a build-id matches to load a shared library."), _("\
-SHow validation a build-id matches to load a shared library."), _("\
-Inferior shared library and symbol file may contain unique build-id.\n\
-If both build-ids are present but they do not match then this setting\n\
-enables (off) or disables (on) loading of such symbol file.\n\
-Loading non-matching symbol file may confuse debugging including breakage\n\
-of backtrace output."),
-                          NULL,
-                          show_validate_build_id,
-                          &setlist, &showlist);
-
 }
This page took 0.026589 seconds and 4 git commands to generate.