2004-02-12 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / elfread.c
index 75384a5020c4a1979e85d6da9fc20ae36d7b0556..83a186275265ec842d68bf1fcea4f6eed829b2f1 100644 (file)
@@ -1,7 +1,7 @@
 /* Read ELF (Executable and Linking Format) object files for GDB.
 
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
    Written by Fred Fish at Cygnus Support.
 
@@ -80,40 +80,40 @@ elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip)
   struct elfinfo *ei;
 
   ei = (struct elfinfo *) eip;
-  if (STREQ (sectp->name, ".debug"))
+  if (strcmp (sectp->name, ".debug") == 0)
     {
       ei->dboffset = sectp->filepos;
       ei->dbsize = bfd_get_section_size_before_reloc (sectp);
     }
-  else if (STREQ (sectp->name, ".line"))
+  else if (strcmp (sectp->name, ".line") == 0)
     {
       ei->lnoffset = sectp->filepos;
       ei->lnsize = bfd_get_section_size_before_reloc (sectp);
     }
-  else if (STREQ (sectp->name, ".stab"))
+  else if (strcmp (sectp->name, ".stab") == 0)
     {
       ei->stabsect = sectp;
     }
-  else if (STREQ (sectp->name, ".stab.index"))
+  else if (strcmp (sectp->name, ".stab.index") == 0)
     {
       ei->stabindexsect = sectp;
     }
-  else if (STREQ (sectp->name, ".mdebug"))
+  else if (strcmp (sectp->name, ".mdebug") == 0)
     {
       ei->mdebugsect = sectp;
     }
 }
 
 static struct minimal_symbol *
-record_minimal_symbol_and_info (char *name, CORE_ADDR address,
-                               enum minimal_symbol_type ms_type, char *info,   /* FIXME, is this really char *? */
-                               asection *bfd_section, struct objfile *objfile)
+record_minimal_symbol (char *name, CORE_ADDR address,
+                      enum minimal_symbol_type ms_type,
+                      asection *bfd_section, struct objfile *objfile)
 {
   if (ms_type == mst_text || ms_type == mst_file_text)
     address = SMASH_TEXT_ADDRESS (address);
 
   return prim_record_minimal_symbol_and_info
-    (name, address, ms_type, info, bfd_section->index, bfd_section, objfile);
+    (name, address, ms_type, NULL, bfd_section->index, bfd_section, objfile);
 }
 
 /*
@@ -159,11 +159,10 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
      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);
+  /* Name of filesym, as saved on the objfile_obstack.  */
+  char *filesymname = obsavestring ("", 0, &objfile->objfile_obstack);
 #endif
   struct dbx_symfile_info *dbx = objfile->sym_stab_info;
-  unsigned long size;
   int stripped = (bfd_get_symcount (objfile->obfd) == 0);
 
   if (dynamic)
@@ -223,9 +222,9 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
              if (symaddr == 0)
                continue;
              symaddr += offset;
-             msym = record_minimal_symbol_and_info
+             msym = record_minimal_symbol
                ((char *) sym->name, symaddr,
-                mst_solib_trampoline, NULL, sym->section, objfile);
+                mst_solib_trampoline, sym->section, objfile);
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
              if (msym != NULL)
                msym->filename = filesymname;
@@ -252,7 +251,7 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
              filesymname =
                obsavestring ((char *) filesym->name, strlen (filesym->name),
-                             &objfile->symbol_obstack);
+                             &objfile->objfile_obstack);
 #endif
            }
          else if (sym->flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK))
@@ -343,10 +342,7 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
                  else if (sym->flags & BSF_LOCAL)
                    {
                      /* Named Local variable in a Data section.
-                        Check its name for stabs-in-elf.  The STREQ
-                        macro checks the first character inline, so
-                        we only actually do a strcmp function call on
-                        names that start with 'B' or 'D'.  */
+                        Check its name for stabs-in-elf.  */
                      int special_local_sect;
                      if (strcmp ("Bbss.bss", sym->name) == 0)
                        special_local_sect = SECT_OFF_BSS (objfile);
@@ -436,11 +432,15 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
                  /* ms_type = mst_unknown; */
                  continue;     /* Skip this symbol. */
                }
-             /* Pass symbol size field in via BFD.  FIXME!!!  */
-             size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
-             msym = record_minimal_symbol_and_info
+             msym = record_minimal_symbol
                ((char *) sym->name, symaddr,
-                ms_type, (void *) size, sym->section, objfile);
+                ms_type, sym->section, objfile);
+             if (msym)
+             {
+               /* Pass symbol size field in via BFD.  FIXME!!!  */
+               unsigned long size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
+               MSYMBOL_SIZE(msym) = size;
+             }
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
              if (msym != NULL)
                msym->filename = filesymname;
@@ -690,7 +690,7 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
   for (; maybe; maybe = maybe->next)
     {
       if (filename[0] == maybe->filename[0]
-         && STREQ (filename, maybe->filename))
+         && strcmp (filename, maybe->filename) == 0)
        {
          /* We found a match.  But there might be several source files
             (from different directories) with the same name.  */
@@ -712,7 +712,7 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
       /* Found it!  Allocate a new psymtab struct, and fill it in.  */
       maybe->found++;
       pst->section_offsets = (struct section_offsets *)
-       obstack_alloc (&objfile->psymbol_obstack, 
+       obstack_alloc (&objfile->objfile_obstack, 
                       SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
       for (i = 0; i < maybe->num_sections; i++)
        (pst->section_offsets)->offsets[i] = maybe->sections[i];
This page took 0.037448 seconds and 4 git commands to generate.