* run.c (usage): Fix typos.
[deliverable/binutils-gdb.git] / gdb / elfread.c
index 84807c066f398d4b9095fde1ffce1b0850dee8e3..9ddf3d489b8f03535ae9ac485992d80677d06881 100644 (file)
@@ -1,6 +1,6 @@
 /* Read ELF (Executable and Linking Format) object files for GDB.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001
+   2001, 2002
    Free Software Foundation, Inc.
    Written by Fred Fish at Cygnus Support.
 
@@ -52,43 +52,7 @@ struct elfinfo
     asection *mdebugsect;      /* Section pointer for .mdebug section */
   };
 
-/* Various things we might complain about... */
-
-struct complaint section_info_complaint =
-{"elf/stab section information %s without a preceding file symbol", 0, 0};
-
-struct complaint section_info_dup_complaint =
-{"duplicated elf/stab section information for %s", 0, 0};
-
-struct complaint stab_info_mismatch_complaint =
-{"elf/stab section information missing for %s", 0, 0};
-
-struct complaint stab_info_questionable_complaint =
-{"elf/stab section information questionable for %s", 0, 0};
-
-static void elf_symfile_init (struct objfile *);
-
-static void elf_new_init (struct objfile *);
-
-static void elf_symfile_read (struct objfile *, int);
-
-static void elf_symfile_finish (struct objfile *);
-
-static void elf_symtab_read (struct objfile *, int);
-
-static void free_elfinfo (PTR);
-
-static struct minimal_symbol *record_minimal_symbol_and_info (char *,
-                                                             CORE_ADDR,
-                                                             enum
-                                                             minimal_symbol_type,
-                                                             char *,
-                                                             asection *
-                                                             bfd_section,
-                                                             struct objfile
-                                                             *);
-
-static void elf_locate_sections (bfd *, asection *, PTR);
+static void free_elfinfo (void *);
 
 /* We are called once per section from elf_symfile_read.  We
    need to examine each section we are passed, check to see
@@ -110,7 +74,7 @@ static void elf_locate_sections (bfd *, asection *, PTR);
    -kingdon).  */
 
 static void
-elf_locate_sections (bfd *ignore_abfd, asection *sectp, PTR eip)
+elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip)
 {
   register struct elfinfo *ei;
 
@@ -173,10 +137,8 @@ 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)
 {
-#ifdef SMASH_TEXT_ADDRESS
   if (ms_type == mst_text || ms_type == mst_file_text)
-    SMASH_TEXT_ADDRESS (address);
-#endif
+    address = SMASH_TEXT_ADDRESS (address);
 
   return prim_record_minimal_symbol_and_info
     (name, address, ms_type, info, bfd_section->index, bfd_section, objfile);
@@ -381,24 +343,14 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
                           || ((sym->flags & BSF_LOCAL)
                               && sym->name[0] == '$'
                               && sym->name[1] == 'L'))
-                   /* Looks like a compiler-generated label.  Skip it.
-                      The assembler should be skipping these (to keep
-                      executables small), but apparently with gcc on the
-                      delta m88k SVR4, it loses.  So to have us check too
-                      should be harmless (but I encourage people to fix this
-                      in the assembler instead of adding checks here).  */
+                   /* Looks like a compiler-generated label.  Skip
+                      it.  The assembler should be skipping these (to
+                      keep executables small), but apparently with
+                      gcc on the (deleted) delta m88k SVR4, it loses.
+                      So to have us check too should be harmless (but
+                      I encourage people to fix this in the assembler
+                      instead of adding checks here).  */
                    continue;
-#ifdef HARRIS_TARGET
-                 else if (sym->name[0] == '.' && sym->name[1] == '.')
-                   {
-                     /* Looks like a Harris compiler generated label for the
-                        purpose of marking instructions that are relevant to
-                        DWARF dies.  The assembler can't get rid of these 
-                        because they are relocatable addresses that the
-                        linker needs to resolve. */
-                     continue;
-                   }
-#endif
                  else
                    {
                      ms_type = mst_file_text;
@@ -445,11 +397,13 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
                            {
                              sectinfo = (struct stab_section_info *)
                                xmmalloc (objfile->md, sizeof (*sectinfo));
-                             memset ((PTR) sectinfo, 0, sizeof (*sectinfo));
+                             memset (sectinfo, 0,
+                                     sizeof (*sectinfo));
                              if (filesym == NULL)
                                {
-                                 complain (&section_info_complaint,
-                                           sym->name);
+                                 complaint (&symfile_complaints,
+                                            "elf/stab section information %s without a preceding file symbol",
+                                            sym->name);
                                }
                              else
                                {
@@ -461,8 +415,9 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
                            { 
                              if (sectinfo->sections[index] != 0)
                                {
-                                 complain (&section_info_dup_complaint,
-                                           sectinfo->filename);
+                                 complaint (&symfile_complaints,
+                                            "duplicated elf/stab section information for %s",
+                                            sectinfo->filename);
                                }
                            }
                          else
@@ -513,14 +468,12 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
              size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
              msym = record_minimal_symbol_and_info
                ((char *) sym->name, symaddr,
-                ms_type, (PTR) size, sym->section, objfile);
+                ms_type, (void *) size, sym->section, objfile);
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
              if (msym != NULL)
                msym->filename = filesymname;
 #endif
-#ifdef ELF_MAKE_MSYMBOL_SPECIAL
              ELF_MAKE_MSYMBOL_SPECIAL (sym, msym);
-#endif
            }
        }
       do_cleanups (back_to);
@@ -576,7 +529,7 @@ elf_symfile_read (struct objfile *objfile, int mainline)
   objfile->sym_stab_info = (struct dbx_symfile_info *)
     xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
   memset ((char *) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
-  make_cleanup (free_elfinfo, (PTR) objfile);
+  make_cleanup (free_elfinfo, (void *) objfile);
 
   /* Process the normal ELF symbol table first.  This may write some 
      chain of info into the dbx_symfile_info in objfile->sym_stab_info,
@@ -601,7 +554,7 @@ elf_symfile_read (struct objfile *objfile, int mainline)
     }
 
   /* We first have to find them... */
-  bfd_map_over_sections (abfd, elf_locate_sections, (PTR) & ei);
+  bfd_map_over_sections (abfd, elf_locate_sections, (void *) & ei);
 
   /* ELF debugging information is inserted into the psymtab in the
      order of least informative first - most informative last.  Since
@@ -656,6 +609,9 @@ elf_symfile_read (struct objfile *objfile, int mainline)
                            ei.lnoffset, ei.lnsize);
     }
 
+  if (DWARF2_BUILD_FRAME_INFO_P ())
+    DWARF2_BUILD_FRAME_INFO(objfile);
+
   /* Install any minimal symbols that have been collected as the current
      minimal symbols for this objfile. */
 
@@ -668,7 +624,7 @@ elf_symfile_read (struct objfile *objfile, int mainline)
    stab_section_info's, that might be dangling from it.  */
 
 static void
-free_elfinfo (PTR objp)
+free_elfinfo (void *objp)
 {
   struct objfile *objfile = (struct objfile *) objp;
   struct dbx_symfile_info *dbxinfo = objfile->sym_stab_info;
@@ -772,7 +728,8 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
 
   if (maybe == 0 && questionable != 0)
     {
-      complain (&stab_info_questionable_complaint, filename);
+      complaint (&symfile_complaints,
+                "elf/stab section information questionable for %s", filename);
       maybe = questionable;
     }
 
@@ -789,7 +746,8 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
 
   /* We were unable to find any offsets for this file.  Complain.  */
   if (dbx->stab_section_info)  /* If there *is* any info, */
-    complain (&stab_info_mismatch_complaint, filename);
+    complaint (&symfile_complaints,
+              "elf/stab section information missing for %s", filename);
 }
 \f
 /* Register that we are able to handle ELF object file formats.  */
This page took 0.042177 seconds and 4 git commands to generate.