* configure.host: Change irix5 to irix[56]*.
[deliverable/binutils-gdb.git] / gdb / dbxread.c
index 927a0e1de8a889f873af7f3d2e69884f22a9d98e..de31d46472d394d344b630250973365678776578 100644 (file)
@@ -1,5 +1,5 @@
 /* Read dbx symbol tables and convert to internal format, for GDB.
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
    Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -16,7 +16,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This module provides three functions: dbx_symfile_init,
    which initializes to read a symbol file; dbx_new_init, which 
@@ -33,19 +33,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    for real.  dbx_psymtab_to_symtab() is the function that does this */
 
 #include "defs.h"
-#include <string.h>
+#include "gdb_string.h"
 
 #if defined(USG) || defined(__CYGNUSCLIB__)
 #include <sys/types.h>
 #include <fcntl.h>
 #endif
 
-#include <obstack.h>
+#include "obstack.h"
 #include <sys/param.h>
 #ifndef        NO_SYS_FILE
 #include <sys/file.h>
 #endif
-#include <sys/stat.h>
+#include "gdb_stat.h"
 #include <ctype.h>
 #include "symtab.h"
 #include "breakpoint.h"
@@ -65,14 +65,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "aout/aout64.h"
 #include "aout/stab_gnu.h"     /* We always use GNU stabs, not native, now */
 
-#if !defined (SEEK_SET)
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#endif
+/* defined in stabsread.c; used for completing cfront stabs strings */
+extern void 
+resolve_cfront_continuation PARAMS((struct objfile * objfile, 
+               struct symbol * sym, char * p));
+
 \f
-/* Each partial symbol table entry contains a pointer to private data for the
-   sym_read function to use when expanding a partial symbol table entry
-   to a full symbol table entry.  */
+/* We put a pointer to this structure in the read_symtab_private field
+   of the psymtab.  */
 
 struct symloc {
 
@@ -159,7 +159,11 @@ static int symfile_relocatable = 0;
 
 static int block_address_function_relative = 0;
 \f
-/* This is the lowest text address we have yet encountered.  */
+/* The lowest text address we have yet encountered.  This is needed
+   because in an a.out file, there is no header field which tells us
+   what address the program is actually going to be loaded at, so we
+   need to make guesses based on the symbols (which *are* relocated to
+   reflect the address it will be loaded at).  */
 static CORE_ADDR lowest_text_address;
 
 /* Complaints about the symbols we have encountered.  */
@@ -242,11 +246,8 @@ add_bincl_to_list PARAMS ((struct partial_symtab *, char *, int));
 static void
 init_bincl_list PARAMS ((int, struct objfile *));
 
-static void
-init_psymbol_list PARAMS ((struct objfile *));
-
 static char *
-dbx_next_symbol_text PARAMS ((void));
+dbx_next_symbol_text PARAMS ((struct objfile *));
 
 static void
 fill_symbuf PARAMS ((bfd *));
@@ -498,12 +499,7 @@ record_minimal_symbol (name, address, type, objfile)
     lowest_text_address = address;
 
   prim_record_minimal_symbol_and_info
-    (obsavestring (name, strlen (name), &objfile -> symbol_obstack),
-     address,
-     ms_type,
-     NULL,
-     section,
-     objfile);
+    (name, address, ms_type, NULL, section, objfile);
 }
 \f
 /* Scan and build partial symbols for a symbol file.
@@ -546,6 +542,7 @@ dbx_symfile_read (objfile, section_offsets, mainline)
     ((0 == strncmp (bfd_get_target (objfile->obfd), "elf", 3))
      || (0 == strncmp (bfd_get_target (objfile->obfd), "som", 3))
      || (0 == strncmp (bfd_get_target (objfile->obfd), "coff", 4))
+     || (0 == strncmp (bfd_get_target (objfile->obfd), "pe", 2))
      || (0 == strncmp (bfd_get_target (objfile->obfd), "nlm", 3)));
 
   sym_bfd = objfile->obfd;
@@ -554,8 +551,10 @@ dbx_symfile_read (objfile, section_offsets, mainline)
     perror_with_name (objfile->name);
 
   /* If we are reinitializing, or if we have never loaded syms yet, init */
-  if (mainline || objfile->global_psymbols.size == 0 || objfile->static_psymbols.size == 0)
-    init_psymbol_list (objfile);
+  if (mainline
+      || objfile->global_psymbols.size == 0
+      || objfile->static_psymbols.size == 0)
+    init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
 
   symbol_size = DBX_SYMBOL_SIZE (objfile);
   symbol_table_offset = DBX_SYMTAB_OFFSET (objfile);
@@ -570,8 +569,8 @@ dbx_symfile_read (objfile, section_offsets, mainline)
      process them and define symbols accordingly.  */
 
   read_dbx_symtab (section_offsets, objfile,
-                  bfd_section_vma  (sym_bfd, DBX_TEXT_SECT (objfile)),
-                  bfd_section_size (sym_bfd, DBX_TEXT_SECT (objfile)));
+                  DBX_TEXT_ADDR (objfile),
+                  DBX_TEXT_SIZE (objfile));
 
   /* Add the dynamic symbols.  */
 
@@ -621,6 +620,7 @@ dbx_symfile_init (objfile)
   int val;
   bfd *sym_bfd = objfile->obfd;
   char *name = bfd_get_filename (sym_bfd);
+  asection *text_sect;
   unsigned char size_temp[DBX_STRINGTAB_SIZE_SIZE];
 
   /* Allocate struct to keep track of the symfile */
@@ -634,9 +634,12 @@ dbx_symfile_init (objfile)
   /* FIXME POKING INSIDE BFD DATA STRUCTURES */
 
   DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL;
-  DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
-  if (!DBX_TEXT_SECT (objfile))
+  
+  text_sect = bfd_get_section_by_name (sym_bfd, ".text");
+  if (!text_sect)
     error ("Can't find .text section in symbol file");
+  DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect);
+  DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect);
 
   DBX_SYMBOL_SIZE (objfile) = obj_symbol_entry_size (sym_bfd);
   DBX_SYMCOUNT (objfile) = bfd_get_symcount (sym_bfd);
@@ -703,6 +706,7 @@ dbx_symfile_init (objfile)
          DBX_STRINGTAB (objfile) =
            (char *) obstack_alloc (&objfile -> psymbol_obstack,
                                    DBX_STRINGTAB_SIZE (objfile));
+         OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile));
          
          /* Now read in the string table in one big gulp.  */
          
@@ -739,17 +743,88 @@ static struct internal_nlist symbuf[4096];
 static int symbuf_idx;
 static int symbuf_end;
 
+/* cont_elem is used for continuing information in cfront.
+   It saves information about which types need to be fixed up and 
+   completed after all the stabs are read.  */
+struct cont_elem 
+  {
+    /* sym and stabsstring for continuing information in cfront */
+    struct symbol * sym;
+    char * stabs;
+    /* state dependancies (statics that must be preserved) */
+    int sym_idx;
+    int sym_end;
+    int symnum;
+    /* other state dependancies include:
+       (assumption is that these will not change since process_now FIXME!!)
+        stringtab_global
+        n_stabs
+        objfile
+        symfile_bfd */
+};
+static struct cont_elem cont_list[100];
+static int cont_count = 0;
+
+void 
+process_later(sym,p)
+  struct symbol * sym;
+  char * p;
+{
+  /* save state so we can process these stabs later */
+  cont_list[cont_count].sym_idx = symbuf_idx;
+  cont_list[cont_count].sym_end = symbuf_end;
+  cont_list[cont_count].symnum = symnum;
+  cont_list[cont_count].sym = sym;
+  cont_list[cont_count].stabs = p;
+  cont_count++;
+}
+
+void 
+process_now(objfile) 
+  struct objfile * objfile;
+{
+  int i;
+  /* save original state */
+  int save_symbuf_idx = symbuf_idx;
+  int save_symbuf_end = symbuf_end;
+  int save_symnum = symnum;
+  for (i=0; i<cont_count; i++) 
+    {
+      /* set state as if we were parsing stabs strings 
+         for this symbol */
+      symbuf_idx = cont_list[i].sym_idx;   /* statics used by gdb */
+      symbuf_end = cont_list[i].sym_end;  
+      symnum = cont_list[i].symnum;  
+      resolve_cfront_continuation(objfile,cont_list[i].sym,cont_list[i].stabs);
+    }
+  /* restore original state */
+  symbuf_idx = save_symbuf_idx;
+  symbuf_end = save_symbuf_end;
+  symnum = save_symnum;
+  cont_count=0;  /* reset for next run */
+}
+
+
 /* Name of last function encountered.  Used in Solaris to approximate
    object file boundaries.  */
 static char *last_function_name;
 
 /* The address in memory of the string table of the object file we are
    reading (which might not be the "main" object file, but might be a
-   shared library or some other dynamically loaded thing).  This is set
-   by read_dbx_symtab when building psymtabs, and by read_ofile_symtab 
-   when building symtabs, and is used only by next_symbol_text.  */
+   shared library or some other dynamically loaded thing).  This is
+   set by read_dbx_symtab when building psymtabs, and by
+   read_ofile_symtab when building symtabs, and is used only by
+   next_symbol_text.  FIXME: If that is true, we don't need it when
+   building psymtabs, right?  */
 static char *stringtab_global;
 
+/* These variables are used to control fill_symbuf when the stabs
+   symbols are not contiguous (as may be the case when a COFF file is
+   linked using --split-by-reloc).  */
+static struct stab_section_list *symbuf_sections;
+static unsigned int symbuf_left;
+static unsigned int symbuf_read;
+
 /* Refill the symbol table input buffer
    and set the variables that control fetching entries from it.
    Reports an error if no data available.
@@ -760,13 +835,37 @@ static void
 fill_symbuf (sym_bfd)
      bfd *sym_bfd;
 {
-  int nbytes = bfd_read ((PTR)symbuf, sizeof (symbuf), 1, sym_bfd);
+  unsigned int count;
+  int nbytes;
+
+  if (symbuf_sections == NULL)
+    count = sizeof (symbuf);
+  else
+    {
+      if (symbuf_left <= 0)
+       {
+         file_ptr filepos = symbuf_sections->section->filepos;
+         if (bfd_seek (sym_bfd, filepos, SEEK_SET) != 0)
+           perror_with_name (bfd_get_filename (sym_bfd));
+         symbuf_left = bfd_section_size (sym_bfd, symbuf_sections->section);
+         symbol_table_offset = filepos - symbuf_read;
+         symbuf_sections = symbuf_sections->next;
+       }
+
+      count = symbuf_left;
+      if (count > sizeof (symbuf))
+       count = sizeof (symbuf);
+    }
+
+  nbytes = bfd_read ((PTR)symbuf, count, 1, sym_bfd);
   if (nbytes < 0)
     perror_with_name (bfd_get_filename (sym_bfd));
   else if (nbytes == 0)
     error ("Premature end of file reading symbol table");
   symbuf_end = nbytes / symbol_size;
   symbuf_idx = 0;
+  symbuf_left -= nbytes;
+  symbuf_read += nbytes;
 }
 
 #define SWAP_SYMBOL(symp, abfd) \
@@ -789,40 +888,18 @@ fill_symbuf (sym_bfd)
    call this function to get the continuation.  */
 
 static char *
-dbx_next_symbol_text ()
+dbx_next_symbol_text (objfile)
+     struct objfile *objfile;
 {
   if (symbuf_idx == symbuf_end)
     fill_symbuf (symfile_bfd);
   symnum++;
   SWAP_SYMBOL(&symbuf[symbuf_idx], symfile_bfd);
+  OBJSTAT (objfile, n_stabs++);
   return symbuf[symbuf_idx++].n_strx + stringtab_global
          + file_string_table_offset;
 }
 \f
-/* Initializes storage for all of the partial symbols that will be
-   created by read_dbx_symtab and subsidiaries.  */
-
-static void
-init_psymbol_list (objfile)
-     struct objfile *objfile;
-{
-  /* Free any previously allocated psymbol lists.  */
-  if (objfile -> global_psymbols.list)
-    mfree (objfile -> md, (PTR)objfile -> global_psymbols.list);
-  if (objfile -> static_psymbols.list)
-    mfree (objfile -> md, (PTR)objfile -> static_psymbols.list);
-
-  /* Current best guess is that there are approximately a twentieth
-     of the total symbols (in a debugging file) are global or static
-     oriented symbols */
-  objfile -> global_psymbols.size = DBX_SYMCOUNT (objfile) / 10;
-  objfile -> static_psymbols.size = DBX_SYMCOUNT (objfile) / 10;
-  objfile -> global_psymbols.next = objfile -> global_psymbols.list = (struct partial_symbol *)
-    xmmalloc (objfile -> md, objfile -> global_psymbols.size * sizeof (struct partial_symbol));
-  objfile -> static_psymbols.next = objfile -> static_psymbols.list = (struct partial_symbol *)
-    xmmalloc (objfile -> md, objfile -> static_psymbols.size * sizeof (struct partial_symbol));
-}
-
 /* Initialize the list of bincls to contain none and have some
    allocated.  */
 
@@ -1025,11 +1102,8 @@ read_dbx_dynamic_symtab (section_offsets, objfile)
        }
 
       name = (char *) bfd_asymbol_name (*rel->sym_ptr_ptr);
-      prim_record_minimal_symbol
-       (obsavestring (name, strlen (name), &objfile -> symbol_obstack),
-        address,
-        mst_solib_trampoline,
-        objfile);
+      prim_record_minimal_symbol (name, address, mst_solib_trampoline,
+                                 objfile);
     }
 
   do_cleanups (back_to);
@@ -1054,6 +1128,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
   int nsl;
   int past_first_source_file = 0;
   CORE_ADDR last_o_file_start = 0;
+  CORE_ADDR last_function_start = 0;
   struct cleanup *back_to;
   bfd *abfd;
 
@@ -1116,6 +1191,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
       if (bufp->n_type == (unsigned char)N_SLINE) continue;
 
       SWAP_SYMBOL (bufp, abfd);
+      OBJSTAT (objfile, n_stabs++);
 
       /* Ok.  There is a lot of code duplicated in the rest of this
          switch statement (for efficiency reasons).  Since I don't
@@ -1195,8 +1271,8 @@ start_psymtab (objfile, section_offsets,
      char *filename;
      CORE_ADDR textlow;
      int ldsymoff;
-     struct partial_symbol *global_syms;
-     struct partial_symbol *static_syms;
+     struct partial_symbol **global_syms;
+     struct partial_symbol **static_syms;
 {
   struct partial_symtab *result =
       start_psymtab_common(objfile, section_offsets,
@@ -1549,6 +1625,7 @@ read_ofile_symtab (pst)
       fill_symbuf (abfd);
       bufp = &symbuf[symbuf_idx++];
       SWAP_SYMBOL (bufp, abfd);
+      OBJSTAT (objfile, n_stabs++);
 
       SET_NAMESTRING ();
 
@@ -1604,6 +1681,7 @@ read_ofile_symtab (pst)
        fill_symbuf(abfd);
       bufp = &symbuf[symbuf_idx++];
       SWAP_SYMBOL (bufp, abfd);
+      OBJSTAT (objfile, n_stabs++);
 
       type = bufp->n_type;
 
@@ -1657,8 +1735,17 @@ read_ofile_symtab (pst)
   if (last_source_start_addr == 0)
     last_source_start_addr = text_offset;
 
-  pst->symtab = end_symtab (text_offset + text_size, 0, 0, objfile,
-                           SECT_OFF_TEXT);
+  /* In reordered executables last_source_start_addr may not be the
+     lower bound for this symtab, instead use text_offset which comes
+     from pst->textlow which is correct.  */
+  if (last_source_start_addr > text_offset)
+    last_source_start_addr = text_offset;
+
+  pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT);
+
+  if (ARM_DEMANGLING)  /* process incomplete C++ types now */
+    process_now(objfile);
+
   end_stabs ();
 }
 
@@ -1733,6 +1820,21 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
     {
     case N_FUN:
     case N_FNAME:
+
+      if (! strcmp (name, ""))
+       {
+         /* This N_FUN marks the end of a function.  This closes off the
+            current block.  */
+         within_function = 0;
+         new = pop_context ();
+
+         /* Make a block for the local symbols within.  */
+         finish_block (new->name, &local_symbols, new->old_blocks,
+                       function_start_offset, function_start_offset + valu,
+                       objfile);
+         break;
+       }
+
       /* Relocate for dynamic loading */
       valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
       goto define_a_symbol;
@@ -1884,7 +1986,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
              patch_subfile_names (current_subfile, name);
              break;            /* Ignore repeated SOs */
            }
-         end_symtab (valu, 0, 0, objfile, SECT_OFF_TEXT);
+         end_symtab (valu, objfile, SECT_OFF_TEXT);
          end_stabs ();
        }
 
@@ -2115,10 +2217,13 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
                  int l = colon_pos - name;
 
                  m = lookup_minimal_symbol_by_pc (last_pc_address);
-                 if (m && STREQN (SYMBOL_NAME (m), name, l))
+                 if (m && STREQN (SYMBOL_NAME (m), name, l)
+                     && SYMBOL_NAME (m) [l] == '\0')
                    /* last_pc_address was in this function */
                    valu = SYMBOL_VALUE (m);
-                 else if (m && STREQN (SYMBOL_NAME (m+1), name, l))
+                 else if (m && SYMBOL_NAME (m+1)
+                          && STREQN (SYMBOL_NAME (m+1), name, l)
+                          && SYMBOL_NAME (m+1) [l] == '\0')
                    /* last_pc_address was in last function */
                    valu = SYMBOL_VALUE (m+1);
                  else
@@ -2195,9 +2300,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
   previous_stab_code = type;
 }
 \f
-/* FIXME: The only difference between this and elfstab_build_psymtabs is
-   the call to install_minimal_symbols for elf.  If the differences are
-   really that small, the code should be shared.  */
+/* FIXME: The only difference between this and elfstab_build_psymtabs
+   is the call to install_minimal_symbols for elf, and the support for
+   split sections.  If the differences are really that small, the code
+   should be shared.  */
 
 /* Scan and build partial symbols for an coff symbol file.
    The coff file has already been processed to get its minimal symbols.
@@ -2210,8 +2316,9 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
    the base address of the text segment).
    MAINLINE is true if we are reading the main symbol
    table (as opposed to a shared lib or dynamically loaded file).
-   STABOFFSET and STABSIZE define the location in OBJFILE where the .stab
-   section exists.
+   TEXTADDR is the address of the text section.
+   TEXTSIZE is the size of the text section.
+   STABSECTS is the list of .stab sections in OBJFILE.
    STABSTROFFSET and STABSTRSIZE define the location in OBJFILE where the
    .stabstr section exists.
 
@@ -2220,13 +2327,14 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
 
 void
 coffstab_build_psymtabs (objfile, section_offsets, mainline, 
-                              staboffset, stabsize,
+                              textaddr, textsize, stabsects,
                               stabstroffset, stabstrsize)
       struct objfile *objfile;
       struct section_offsets *section_offsets;
       int mainline;
-      file_ptr staboffset;
-      unsigned int stabsize;
+      CORE_ADDR textaddr;
+      unsigned int textsize;
+      struct stab_section_list *stabsects;
       file_ptr stabstroffset;
       unsigned int stabstrsize;
 {
@@ -2234,25 +2342,24 @@ coffstab_build_psymtabs (objfile, section_offsets, mainline,
   bfd *sym_bfd = objfile->obfd;
   char *name = bfd_get_filename (sym_bfd);
   struct dbx_symfile_info *info;
+  unsigned int stabsize;
 
   /* There is already a dbx_symfile_info allocated by our caller.
      It might even contain some info from the coff symtab to help us.  */
   info = (struct dbx_symfile_info *) objfile->sym_stab_info;
 
-  DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
-  if (!DBX_TEXT_SECT (objfile))
-    error ("Can't find .text section in symbol file");
+  DBX_TEXT_ADDR (objfile) = textaddr;
+  DBX_TEXT_SIZE (objfile) = textsize;
 
 #define        COFF_STABS_SYMBOL_SIZE  12      /* XXX FIXME XXX */
   DBX_SYMBOL_SIZE    (objfile) = COFF_STABS_SYMBOL_SIZE;
-  DBX_SYMCOUNT       (objfile) = stabsize / DBX_SYMBOL_SIZE (objfile);
   DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
-  DBX_SYMTAB_OFFSET  (objfile) = staboffset;
   
   if (stabstrsize > bfd_get_size (sym_bfd))
     error ("ridiculous string table size: %d bytes", stabstrsize);
   DBX_STRINGTAB (objfile) = (char *)
     obstack_alloc (&objfile->psymbol_obstack, stabstrsize+1);
+  OBJSTAT (objfile, sz_strtab += stabstrsize+1);
 
   /* Now read in the string table in one big gulp.  */
 
@@ -2273,6 +2380,30 @@ coffstab_build_psymtabs (objfile, section_offsets, mainline,
   /* In a coff file, we've already installed the minimal symbols that came
      from the coff (non-stab) symbol table, so always act like an
      incremental load here. */
+  if (stabsects->next == NULL)
+    {
+      stabsize = bfd_section_size (sym_bfd, stabsects->section);
+      DBX_SYMCOUNT (objfile) = stabsize / DBX_SYMBOL_SIZE (objfile);
+      DBX_SYMTAB_OFFSET (objfile) = stabsects->section->filepos;
+    }
+  else
+    {
+      struct stab_section_list *stabsect;
+
+      DBX_SYMCOUNT (objfile) = 0;
+      for (stabsect = stabsects; stabsect != NULL; stabsect = stabsect->next)
+       {
+         stabsize = bfd_section_size (sym_bfd, stabsect->section);
+         DBX_SYMCOUNT (objfile) += stabsize / DBX_SYMBOL_SIZE (objfile);
+       }
+
+      DBX_SYMTAB_OFFSET (objfile) = stabsects->section->filepos;
+
+      symbuf_sections = stabsects->next;
+      symbuf_left = bfd_section_size (sym_bfd, stabsects->section);
+      symbuf_read = 0;
+    }
+
   dbx_symfile_read (objfile, section_offsets, 0);
 }
 \f
@@ -2312,14 +2443,17 @@ elfstab_build_psymtabs (objfile, section_offsets, mainline,
   bfd *sym_bfd = objfile->obfd;
   char *name = bfd_get_filename (sym_bfd);
   struct dbx_symfile_info *info;
+  asection *text_sect;
 
   /* There is already a dbx_symfile_info allocated by our caller.
      It might even contain some info from the ELF symtab to help us.  */
   info = (struct dbx_symfile_info *) objfile->sym_stab_info;
 
-  DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
-  if (!DBX_TEXT_SECT (objfile))
+  text_sect = bfd_get_section_by_name (sym_bfd, ".text");
+  if (!text_sect)
     error ("Can't find .text section in symbol file");
+  DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect);
+  DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect);
 
 #define        ELF_STABS_SYMBOL_SIZE   12      /* XXX FIXME XXX */
   DBX_SYMBOL_SIZE    (objfile) = ELF_STABS_SYMBOL_SIZE;
@@ -2331,6 +2465,7 @@ elfstab_build_psymtabs (objfile, section_offsets, mainline,
     error ("ridiculous string table size: %d bytes", stabstrsize);
   DBX_STRINGTAB (objfile) = (char *)
     obstack_alloc (&objfile->psymbol_obstack, stabstrsize+1);
+  OBJSTAT (objfile, sz_strtab += stabstrsize+1);
 
   /* Now read in the string table in one big gulp.  */
 
@@ -2387,6 +2522,7 @@ stabsect_build_psymtabs (objfile, section_offsets, mainline, stab_name,
   char *name = bfd_get_filename (sym_bfd);
   asection *stabsect;
   asection *stabstrsect;
+  asection *text_sect;
 
   stabsect = bfd_get_section_by_name (sym_bfd, stab_name);
   stabstrsect = bfd_get_section_by_name (sym_bfd, stabstr_name);
@@ -2401,9 +2537,11 @@ stabsect_build_psymtabs (objfile, section_offsets, mainline, stab_name,
   objfile->sym_stab_info = (PTR) xmalloc (sizeof (struct dbx_symfile_info));
   memset (DBX_SYMFILE_INFO (objfile), 0, sizeof (struct dbx_symfile_info));
 
-  DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, text_name);
-  if (!DBX_TEXT_SECT (objfile))
+  text_sect = bfd_get_section_by_name (sym_bfd, text_name);
+  if (!text_sect)
     error ("Can't find %s section in symbol file", text_name);
+  DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect);
+  DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect);
 
   DBX_SYMBOL_SIZE    (objfile) = sizeof (struct external_nlist);
   DBX_SYMCOUNT       (objfile) = bfd_section_size (sym_bfd, stabsect)
@@ -2415,6 +2553,7 @@ stabsect_build_psymtabs (objfile, section_offsets, mainline, stab_name,
     error ("ridiculous string table size: %d bytes", DBX_STRINGTAB_SIZE (objfile));
   DBX_STRINGTAB (objfile) = (char *)
     obstack_alloc (&objfile->psymbol_obstack, DBX_STRINGTAB_SIZE (objfile) + 1);
+  OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile) + 1);
 
   /* Now read in the string table in one big gulp.  */
 
@@ -2439,29 +2578,6 @@ stabsect_build_psymtabs (objfile, section_offsets, mainline, stab_name,
   dbx_symfile_read (objfile, section_offsets, 0);
 }
 \f
-/* Parse the user's idea of an offset for dynamic linking, into our idea
-   of how to represent it for fast symbol reading.  */
-
-static struct section_offsets *
-dbx_symfile_offsets (objfile, addr)
-     struct objfile *objfile;
-     CORE_ADDR addr;
-{
-  struct section_offsets *section_offsets;
-  int i;
-
-  objfile->num_sections = SECT_OFF_MAX;
-  section_offsets = (struct section_offsets *)
-    obstack_alloc (&objfile -> psymbol_obstack,
-                  sizeof (struct section_offsets)
-                  + sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1));
-
-  for (i = 0; i < SECT_OFF_MAX; i++)
-    ANOFFSET (section_offsets, i) = addr;
-  
-  return section_offsets;
-}
-\f
 static struct sym_fns aout_sym_fns =
 {
   bfd_target_aout_flavour,
@@ -2469,7 +2585,8 @@ static struct sym_fns aout_sym_fns =
   dbx_symfile_init,    /* sym_init: read initial info, setup for sym_read() */
   dbx_symfile_read,    /* sym_read: read a symbol file into symtab */
   dbx_symfile_finish,  /* sym_finish: finished with file, cleanup */
-  dbx_symfile_offsets, /* sym_offsets: parse user's offsets to internal form */
+  default_symfile_offsets,
+                       /* sym_offsets: parse user's offsets to internal form */
   NULL                 /* next: pointer to next struct sym_fns */
 };
 
This page took 0.030863 seconds and 4 git commands to generate.