* inftarg.c (child_thread_alive): New function to see if a
[deliverable/binutils-gdb.git] / gdb / elfread.c
index 0b16463fae37861f472fc0145d539b676644346b..0425c01ce42a53a7ce6d1fed0e6c515e1882291e 100644 (file)
@@ -81,7 +81,7 @@ free_elfinfo PARAMS ((void *));
 static struct section_offsets *
 elf_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
 
-static void
+static struct minimal_symbol *
 record_minimal_symbol_and_info PARAMS ((char *, CORE_ADDR,
                                        enum minimal_symbol_type, char *,
                                        struct objfile *));
@@ -171,7 +171,7 @@ elf_interpreter (abfd)
 
 #endif
 
-static void
+static struct minimal_symbol *
 record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
      char *name;
      CORE_ADDR address;
@@ -206,8 +206,8 @@ record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
     }
 
   name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
-  prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
-                                      objfile);
+  return prim_record_minimal_symbol_and_info
+    (name, address, ms_type, info, section, objfile);
 }
 
 /*
@@ -219,7 +219,7 @@ LOCAL FUNCTION
 SYNOPSIS
 
        void elf_symtab_read (bfd *abfd, CORE_ADDR addr,
-                             struct objfile *objfile)
+                             struct objfile *objfile, int dynamic)
 
 DESCRIPTION
 
@@ -258,6 +258,10 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
   /* If filesym is nonzero, it points to a file symbol, but we haven't
      seen any section info for it yet.  */
   asymbol *filesym = 0;
+#ifdef SOFUN_ADDRESS_MAYBE_MISSING
+  /* Name of filesym, as saved on the symbol_obstack.  */
+  char *filesymname = obsavestring ("", 0, &objfile->symbol_obstack);
+#endif
   struct dbx_symfile_info *dbx = (struct dbx_symfile_info *)
                                 objfile->sym_stab_info;
   unsigned long size;
@@ -300,9 +304,12 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
              continue;
            }
 
-         if (sym -> section == &bfd_und_section
+         if (dynamic
+             && sym -> section == &bfd_und_section
              && (sym -> flags & BSF_FUNCTION))
            {
+             struct minimal_symbol *msym;
+
              /* Symbol is a reference to a function defined in
                 a shared library.
                 If its value is non zero then it is usually the address
@@ -310,17 +317,17 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
                 relative to the base address.
                 If its value is zero then the dynamic linker has to resolve
                 the symbol. We are unable to find any meaningful address
-                for this symbol in the executable file, so we skip it.
-                Irix 5 has a zero value for all shared library functions
-                in the main symbol table, but the dynamic symbol table
-                provides the right values.  */
+                for this symbol in the executable file, so we skip it.  */
              symaddr = sym -> value;
              if (symaddr == 0)
                continue;
              symaddr += addr;
-             record_minimal_symbol_and_info ((char *) sym -> name, symaddr,
-                                             mst_solib_trampoline, NULL,
-                                             objfile);
+             msym = record_minimal_symbol_and_info
+               ((char *) sym -> name, symaddr,
+               mst_solib_trampoline, NULL, objfile);
+#ifdef SOFUN_ADDRESS_MAYBE_MISSING
+             msym->filename = filesymname;
+#endif
              continue;
            }
 
@@ -340,9 +347,16 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
                  sectinfo = NULL;
                }
              filesym = sym;
+#ifdef SOFUN_ADDRESS_MAYBE_MISSING
+             filesymname =
+               obsavestring ((char *)filesym->name, strlen (filesym->name),
+                             &objfile->symbol_obstack);
+#endif
            }
          else if (sym -> flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK))
            {
+             struct minimal_symbol *msym;
+
              /* Select global/local/weak symbols.  Note that bfd puts abs
                 symbols in their own section, so all symbols we are
                 interested in will have a section. */
@@ -387,7 +401,7 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
                    }
                  else if ((sym->name[0] == '.' && sym->name[1] == 'L')
                           || ((sym -> flags & BSF_LOCAL)
-                              && sym->name[0] == 'L'
+                              && sym->name[0] == '$'
                               && sym->name[1] == 'L'))
                    /* Looks like a compiler-generated label.  Skip it.
                       The assembler should be skipping these (to keep
@@ -498,8 +512,12 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
                }
              /* Pass symbol size field in via BFD.  FIXME!!!  */
              size = ((elf_symbol_type *) sym) -> internal_elf_sym.st_size;
-             record_minimal_symbol_and_info ((char *) sym -> name, symaddr,
-                                             ms_type, (PTR) size, objfile);
+             msym = record_minimal_symbol_and_info
+               ((char *) sym -> name, symaddr,
+                ms_type, (PTR) size, objfile);
+#ifdef SOFUN_ADDRESS_MAYBE_MISSING
+             msym->filename = filesymname;
+#endif
            }
        }
       do_cleanups (back_to);
This page took 0.024604 seconds and 4 git commands to generate.