Code cleanup: Add objfile_name accessor
[deliverable/binutils-gdb.git] / gdb / elfread.c
index 710e9e5d46083eb87e19c4d4445e25cb8696ff0d..cbb55b1ecd0fdcc427d02580666fc4f65c84cb4f 100644 (file)
@@ -574,6 +574,21 @@ elf_symtab_read (struct objfile *objfile, int type,
              gdbarch_elf_make_msymbol_special (gdbarch, sym, msym);
            }
 
+         /* If we see a default versioned symbol, install it under
+            its version-less name.  */
+         if (msym != NULL)
+           {
+             const char *atsign = strchr (sym->name, '@');
+
+             if (atsign != NULL && atsign[1] == '@' && atsign > sym->name)
+               {
+                 int len = atsign - sym->name;
+
+                 record_minimal_symbol (sym->name, len, 1, symaddr,
+                                        ms_type, sym->section, objfile);
+               }
+           }
+
          /* For @plt symbols, also record a trampoline to the
             destination symbol.  The @plt symbol will be used in
             disassembly, and the trampoline will be used when we are
@@ -621,7 +636,7 @@ elf_rel_plt_read (struct objfile *objfile, asymbol **dyn_symbol_table)
   char *string_buffer = NULL;
   size_t string_buffer_size = 0;
   struct cleanup *back_to;
-  struct gdbarch *gdbarch = objfile->gdbarch;
+  struct gdbarch *gdbarch = get_objfile_arch (objfile);
   struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
   size_t ptr_size = TYPE_LENGTH (ptr_type);
 
@@ -782,7 +797,7 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
   if (*slot != NULL)
     {
       struct elf_gnu_ifunc_cache *entry_found_p = *slot;
-      struct gdbarch *gdbarch = objfile->gdbarch;
+      struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
       if (entry_found_p->addr != addr)
        {
@@ -862,7 +877,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
   ALL_PSPACE_OBJFILES (current_program_space, objfile)
     {
       bfd *obfd = objfile->obfd;
-      struct gdbarch *gdbarch = objfile->gdbarch;
+      struct gdbarch *gdbarch = get_objfile_arch (objfile);
       struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
       size_t ptr_size = TYPE_LENGTH (ptr_type);
       CORE_ADDR pointer_address, addr;
@@ -1185,7 +1200,7 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
       build_id_name = build_id_to_debug_filename (build_id);
       /* Prevent looping on a stripped .debug file.  */
       if (build_id_name != NULL
-         && filename_cmp (build_id_name, objfile->name) == 0)
+         && filename_cmp (build_id_name, objfile_name (objfile)) == 0)
         {
          warning (_("\"%s\": separate debug info file has no debug info"),
                   build_id_name);
@@ -1240,7 +1255,7 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
     {
       fprintf_unfiltered (gdb_stdlog,
                          "Reading minimal symbols of objfile %s ...\n",
-                         objfile->name);
+                         objfile_name (objfile));
     }
 
   init_minimal_symbol_collection ();
@@ -1349,6 +1364,9 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
   install_minimal_symbols (objfile);
   do_cleanups (back_to);
 
+  if (symtab_create_debug)
+    fprintf_unfiltered (gdb_stdlog, "Done reading minimal symbols.\n");
+
   /* Now process debugging information, which is contained in
      special ELF sections.  */
 
@@ -1393,9 +1411,6 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
                                bfd_section_size (abfd, str_sect));
     }
 
-  if (symtab_create_debug)
-    fprintf_unfiltered (gdb_stdlog, "Done reading minimal symbols.\n");
-
   if (dwarf2_has_info (objfile, NULL))
     {
       /* elf_sym_fns_gdb_index cannot handle simultaneous non-DWARF debug
@@ -1628,6 +1643,15 @@ elf_get_probe_argument_count (struct probe *probe)
   return probe->pops->get_probe_argument_count (probe);
 }
 
+/* Implementation of `sym_can_evaluate_probe_arguments', as documented in
+   symfile.h.  */
+
+static int
+elf_can_evaluate_probe_arguments (struct probe *probe)
+{
+  return probe->pops->can_evaluate_probe_arguments (probe);
+}
+
 /* Implementation of `sym_evaluate_probe_argument', as documented in
    symfile.h.  */
 
@@ -1652,8 +1676,8 @@ elf_compile_to_ax (struct probe *probe,
 
 static void
 elf_symfile_relocate_probe (struct objfile *objfile,
-                           struct section_offsets *new_offsets,
-                           struct section_offsets *delta)
+                           const struct section_offsets *new_offsets,
+                           const struct section_offsets *delta)
 {
   int ix;
   VEC (probe_p) *probes = objfile_data (objfile, probe_key);
@@ -1685,11 +1709,12 @@ probe_key_free (struct objfile *objfile, void *d)
 
 static const struct sym_probe_fns elf_probe_fns =
 {
-  elf_get_probes,              /* sym_get_probes */
-  elf_get_probe_argument_count,        /* sym_get_probe_argument_count */
-  elf_evaluate_probe_argument, /* sym_evaluate_probe_argument */
-  elf_compile_to_ax,           /* sym_compile_to_ax */
-  elf_symfile_relocate_probe,  /* sym_relocate_probe */
+  elf_get_probes,                  /* sym_get_probes */
+  elf_get_probe_argument_count,            /* sym_get_probe_argument_count */
+  elf_can_evaluate_probe_arguments, /* sym_can_evaluate_probe_arguments */
+  elf_evaluate_probe_argument,     /* sym_evaluate_probe_argument */
+  elf_compile_to_ax,               /* sym_compile_to_ax */
+  elf_symfile_relocate_probe,      /* sym_relocate_probe */
 };
 
 /* Register that we are able to handle ELF object file formats.  */
This page took 0.025639 seconds and 4 git commands to generate.