* breakpoint.c, breakpoint.h (breakpoint_init_inferior): New function
[deliverable/binutils-gdb.git] / gdb / elfread.c
index d9670d638e2661d56b1408c7e14de28c56898117..9b9e3646d09876318fd55ca669a82b134076a93d 100644 (file)
@@ -20,6 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
 #include "bfd.h"
+#include <time.h> /* For time_t in libbfd.h.  */
+#include <sys/types.h> /* For time_t, if not in time.h.  */
 #include "libbfd.h"            /* For bfd_elf_find_section */
 #include "libelf.h"
 #include "symtab.h"
@@ -75,7 +77,7 @@ static void
 elf_symtab_read PARAMS ((bfd *,  CORE_ADDR, struct objfile *));
 
 static void
-free_elfinfo PARAMS ((PTR));
+free_elfinfo PARAMS ((void *));
 
 static struct section_offsets *
 elf_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
@@ -86,7 +88,7 @@ record_minimal_symbol_and_info PARAMS ((char *, CORE_ADDR,
                                        struct objfile *));
 
 static void
-elf_locate_sections PARAMS ((bfd *, asection *, PTR));
+elf_locate_sections PARAMS ((bfd *, asection *, void *));
 
 /* We are called once per section from elf_symfile_read.  We
    need to examine each section we are passed, check to see
@@ -102,7 +104,10 @@ elf_locate_sections PARAMS ((bfd *, asection *, PTR));
    We also recognize the ".stab" sections used by the Sun compilers
    released with Solaris 2.
 
-   FIXME:  The section names should not be hardwired strings. */
+   FIXME: The section names should not be hardwired strings (what
+   should they be?  I don't think most object file formats have enough
+   section flags to specify what kind of debug section it is
+   -kingdon).  */
 
 static void
 elf_locate_sections (ignore_abfd, sectp, eip)
@@ -171,8 +176,31 @@ record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
      char *info;               /* FIXME, is this really char *? */
      struct objfile *objfile;
 {
+  int section;
+
+  /* Guess the section from the type.  This is likely to be wrong in
+     some cases.  */
+  switch (ms_type)
+    {
+    case mst_text:
+    case mst_file_text:
+      section = SECT_OFF_TEXT;
+      break;
+    case mst_data:
+    case mst_file_data:
+      section = SECT_OFF_DATA;
+      break;
+    case mst_bss:
+    case mst_file_bss:
+      section = SECT_OFF_BSS;
+      break;
+    default:
+      section = -1;
+      break;
+    }
+
   name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
-  prim_record_minimal_symbol_and_info (name, address, ms_type, info, -1);
+  prim_record_minimal_symbol_and_info (name, address, ms_type, info, section);
 }
 
 /*
@@ -223,7 +251,7 @@ elf_symtab_read (abfd, addr, objfile)
      seen any section info for it yet.  */
   asymbol *filesym = 0;
   struct dbx_symfile_info *dbx = (struct dbx_symfile_info *)
-                                objfile->sym_private;
+                                objfile->sym_stab_info;
   unsigned long size;
   
   storage_needed = get_symtab_upper_bound (abfd);
@@ -387,7 +415,7 @@ elf_symtab_read (abfd, addr, objfile)
                  continue;             /* Skip this symbol. */
                }
              /* Pass symbol size field in via BFD.  FIXME!!!  */
-             size = ((elf32_symbol_type *) sym) -> internal_elf_sym.st_size;
+             size = ((elf_symbol_type *) sym) -> internal_elf_sym.st_size;
              record_minimal_symbol_and_info ((char *) sym -> name, symaddr,
                                              ms_type, (PTR) size, objfile);
            }
@@ -444,13 +472,13 @@ elf_symfile_read (objfile, section_offsets, mainline)
   memset ((char *) &ei, 0, sizeof (ei));
 
   /* Allocate struct to keep track of the symfile */
-  objfile->sym_private = (PTR)
+  objfile->sym_stab_info = (PTR)
     xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
-  memset ((char *) objfile->sym_private, 0, sizeof (struct dbx_symfile_info));
+  memset ((char *) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
   make_cleanup (free_elfinfo, (PTR) objfile);
 
   /* Process the normal ELF symbol table first.  This may write some 
-     chain of info into the dbx_symfile_info in objfile->sym_private,
+     chain of info into the dbx_symfile_info in objfile->sym_stab_info,
      which can later be used by elfstab_offset_sections.  */
 
   /* FIXME, should take a section_offsets param, not just an offset.  */
@@ -507,7 +535,7 @@ elf_symfile_read (objfile, section_offsets, mainline)
   do_cleanups (back_to);
 }
 
-/* This cleans up the objfile's sym_private pointer, and the chain of
+/* This cleans up the objfile's sym_stab_info pointer, and the chain of
    stab_section_info's, that might be dangling from it.  */
 
 static void
@@ -516,7 +544,7 @@ free_elfinfo (objp)
 {
   struct objfile *objfile = (struct objfile *)objp;
   struct dbx_symfile_info *dbxinfo = (struct dbx_symfile_info *)
-                                    objfile->sym_private;
+                                    objfile->sym_stab_info;
   struct stab_section_info *ssi, *nssi;
 
   ssi = dbxinfo->stab_section_info;
@@ -554,9 +582,9 @@ static void
 elf_symfile_finish (objfile)
      struct objfile *objfile;
 {
-  if (objfile -> sym_private != NULL)
+  if (objfile -> sym_stab_info != NULL)
     {
-      mfree (objfile -> md, objfile -> sym_private);
+      mfree (objfile -> md, objfile -> sym_stab_info);
     }
 }
 
@@ -614,7 +642,7 @@ elfstab_offset_sections (objfile, pst)
 {
   char *filename = pst->filename;
   struct dbx_symfile_info *dbx = (struct dbx_symfile_info *)
-                                objfile->sym_private;
+                                objfile->sym_stab_info;
   struct stab_section_info *maybe = dbx->stab_section_info;
   struct stab_section_info *questionable = 0;
   int i;
This page took 0.024965 seconds and 4 git commands to generate.