* sparc-nat.c: Include "inf-ptrace.h".
[binutils-gdb.git] / gdb / dbxread.c
index b59c4b2256c698475f26e80f4725f44376eed887..32db167c375e7ad955576bf605d5fc4fc17da4c2 100644 (file)
@@ -1,6 +1,6 @@
 /* Read dbx symbol tables and convert to internal format, for GDB.
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003.
+   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004.
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -37,7 +37,7 @@
 #include "defs.h"
 #include "gdb_string.h"
 
-#if defined(USG) || defined(__CYGNUSCLIB__)
+#if defined(__CYGNUSCLIB__)
 #include <sys/types.h>
 #include <fcntl.h>
 #endif
 #include "target.h"
 #include "gdbcore.h"           /* for bfd stuff */
 #include "libaout.h"           /* FIXME Secret internal BFD stuff for a.out */
-#include "symfile.h"
 #include "objfiles.h"
 #include "buildsym.h"
 #include "stabsread.h"
 #include "gdb-stabs.h"
 #include "demangle.h"
-#include "language.h"          /* Needed for local_hex_string */
 #include "complaints.h"
 #include "cp-abi.h"
 #include "gdb_assert.h"
 #include "aout/stab_gnu.h"     /* We always use GNU stabs, not native, now */
 \f
 
-/* This macro returns the size field of a minimal symbol, which is normally
-   stored in the "info" field.  The macro can be overridden for specific
-   targets (e.g. MIPS16) that use the info field for other purposes.  */
-#ifndef MSYMBOL_SIZE
-#define MSYMBOL_SIZE(msym) ((long) MSYMBOL_INFO (msym))
-#endif
-
-
 /* We put a pointer to this structure in the read_symtab_private field
    of the psymtab.  */
 
@@ -258,10 +248,6 @@ static int bincls_allocated;
 
 extern void _initialize_dbxread (void);
 
-#if 0 /* OBSOLETE CFront */
-// OBSOLETE static void process_now (struct objfile *);
-#endif /* OBSOLETE CFront */
-
 static void read_ofile_symtab (struct partial_symtab *);
 
 static void dbx_psymtab_to_symtab (struct partial_symtab *);
@@ -356,7 +342,7 @@ add_old_header_file (char *name, int instance)
   int i;
 
   for (i = 0; i < N_HEADER_FILES (current_objfile); i++)
-    if (STREQ (p[i].name, name) && instance == p[i].instance)
+    if (strcmp (p[i].name, name) == 0 && instance == p[i].instance)
       {
        add_this_object_header_file (i);
        return;
@@ -495,7 +481,7 @@ record_minimal_symbol (char *name, CORE_ADDR address, int type,
          Record it as global even if it's local, not global, so
          lookup_minimal_symbol can find it.  We don't check symbol_leading_char
          because for SunOS4 it always is '_'.  */
-      if (name[8] == 'C' && STREQ ("__DYNAMIC", name))
+      if (name[8] == 'C' && DEPRECATED_STREQ ("__DYNAMIC", name))
        ms_type = mst_data;
 
       /* Same with virtual function tables, both global and static.  */
@@ -638,7 +624,7 @@ dbx_symfile_init (struct objfile *objfile)
 
   /* Allocate struct to keep track of the symfile */
   objfile->sym_stab_info = (struct dbx_symfile_info *)
-    xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
+    xmalloc (sizeof (struct dbx_symfile_info));
   memset (objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
 
   DBX_TEXT_SECTION (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
@@ -663,14 +649,13 @@ dbx_symfile_init (struct objfile *objfile)
   DBX_SYMCOUNT (objfile) = bfd_get_symcount (sym_bfd);
   DBX_SYMTAB_OFFSET (objfile) = SYMBOL_TABLE_OFFSET;
 
-  /* Read the string table and stash it away in the psymbol_obstack.  It is
-     only needed as long as we need to expand psymbols into full symbols,
-     so when we blow away the psymbol the string table goes away as well.
+  /* Read the string table and stash it away in the objfile_obstack.
+     When we blow away the objfile the string table goes away as well.
      Note that gdb used to use the results of attempting to malloc the
      string table, based on the size it read, as a form of sanity check
      for botched byte swapping, on the theory that a byte swapped string
      table size would be so totally bogus that the malloc would fail.  Now
-     that we put in on the psymbol_obstack, we can't do this since gdb gets
+     that we put in on the objfile_obstack, we can't do this since gdb gets
      a fatal error (out of virtual memory) if the size is bogus.  We can
      however at least check to see if the size is less than the size of
      the size field itself, or larger than the size of the entire file.
@@ -722,7 +707,7 @@ dbx_symfile_init (struct objfile *objfile)
                   DBX_STRINGTAB_SIZE (objfile));
 
          DBX_STRINGTAB (objfile) =
-           (char *) obstack_alloc (&objfile->psymbol_obstack,
+           (char *) obstack_alloc (&objfile->objfile_obstack,
                                    DBX_STRINGTAB_SIZE (objfile));
          OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile));
 
@@ -752,8 +737,8 @@ dbx_symfile_finish (struct objfile *objfile)
     {
       if (HEADER_FILES (objfile) != NULL)
        {
-         register int i = N_HEADER_FILES (objfile);
-         register struct header_file *hfiles = HEADER_FILES (objfile);
+         int i = N_HEADER_FILES (objfile);
+         struct header_file *hfiles = HEADER_FILES (objfile);
 
          while (--i >= 0)
            {
@@ -762,7 +747,7 @@ dbx_symfile_finish (struct objfile *objfile)
            }
          xfree (hfiles);
        }
-      xmfree (objfile->md, objfile->sym_stab_info);
+      xfree (objfile->sym_stab_info);
     }
   free_header_files ();
 }
@@ -773,107 +758,6 @@ static struct external_nlist symbuf[4096];
 static int symbuf_idx;
 static int symbuf_end;
 
-#if 0 /* OBSOLETE CFront */
-// OBSOLETE  /* cont_elem is used for continuing information in cfront.
-// OBSOLETE     It saves information about which types need to be fixed up and 
-// OBSOLETE     completed after all the stabs are read.  */
-// OBSOLETE  struct cont_elem
-// OBSOLETE    {
-// OBSOLETE      /* sym and stabstring for continuing information in cfront */
-// OBSOLETE      struct symbol *sym;
-// OBSOLETE      char *stabs;
-// OBSOLETE      /* state dependencies (statics that must be preserved) */
-// OBSOLETE      int sym_idx;
-// OBSOLETE      int sym_end;
-// OBSOLETE      int symnum;
-// OBSOLETE      int (*func) (struct objfile *, struct symbol *, char *);
-// OBSOLETE      /* other state dependencies include:
-// OBSOLETE         (assumption is that these will not change since process_now FIXME!!)
-// OBSOLETE         stringtab_global
-// OBSOLETE         n_stabs
-// OBSOLETE         objfile
-// OBSOLETE         symfile_bfd */
-// OBSOLETE    };
-
-// OBSOLETE  static struct cont_elem *cont_list = 0;
-// OBSOLETE  static int cont_limit = 0;
-// OBSOLETE  static int cont_count = 0;
-
-// OBSOLETE  /* Arrange for function F to be called with arguments SYM and P later
-// OBSOLETE     in the stabs reading process.  */
-// OBSOLETE  void
-// OBSOLETE  process_later (struct symbol *sym, char *p,
-// OBSOLETE           int (*f) (struct objfile *, struct symbol *, char *))
-// OBSOLETE  {
-
-// OBSOLETE    /* Allocate more space for the deferred list.  */
-// OBSOLETE    if (cont_count >= cont_limit - 1)
-// OBSOLETE      {
-// OBSOLETE        cont_limit += 32;           /* chunk size */
-
-// OBSOLETE        cont_list
-// OBSOLETE    = (struct cont_elem *) xrealloc (cont_list,
-// OBSOLETE                                     (cont_limit
-// OBSOLETE                                      * sizeof (struct cont_elem)));
-// OBSOLETE        if (!cont_list)
-// OBSOLETE    error ("Virtual memory exhausted\n");
-// OBSOLETE      }
-
-// OBSOLETE    /* Save state variables so we can process these stabs later.  */
-// OBSOLETE    cont_list[cont_count].sym_idx = symbuf_idx;
-// OBSOLETE    cont_list[cont_count].sym_end = symbuf_end;
-// OBSOLETE    cont_list[cont_count].symnum = symnum;
-// OBSOLETE    cont_list[cont_count].sym = sym;
-// OBSOLETE    cont_list[cont_count].stabs = p;
-// OBSOLETE    cont_list[cont_count].func = f;
-// OBSOLETE    cont_count++;
-// OBSOLETE  }
-
-// OBSOLETE  /* Call deferred funtions in CONT_LIST.  */
-
-// OBSOLETE  static void
-// OBSOLETE  process_now (struct objfile *objfile)
-// OBSOLETE  {
-// OBSOLETE    int i;
-// OBSOLETE    int save_symbuf_idx;
-// OBSOLETE    int save_symbuf_end;
-// OBSOLETE    int save_symnum;
-// OBSOLETE    struct symbol *sym;
-// OBSOLETE    char *stabs;
-// OBSOLETE    int err;
-// OBSOLETE    int (*func) (struct objfile *, struct symbol *, char *);
-
-// OBSOLETE    /* Save the state of our caller, we'll want to restore it before
-// OBSOLETE       returning.  */
-// OBSOLETE    save_symbuf_idx = symbuf_idx;
-// OBSOLETE    save_symbuf_end = symbuf_end;
-// OBSOLETE    save_symnum = symnum;
-
-// OBSOLETE    /* Iterate over all the deferred stabs.  */
-// OBSOLETE    for (i = 0; i < cont_count; i++)
-// OBSOLETE      {
-// OBSOLETE        /* Restore the state for this deferred stab.  */
-// OBSOLETE        symbuf_idx = cont_list[i].sym_idx;
-// OBSOLETE        symbuf_end = cont_list[i].sym_end;
-// OBSOLETE        symnum = cont_list[i].symnum;
-// OBSOLETE        sym = cont_list[i].sym;
-// OBSOLETE        stabs = cont_list[i].stabs;
-// OBSOLETE        func = cont_list[i].func;
-
-// OBSOLETE        /* Call the function to handle this deferrd stab.  */
-// OBSOLETE        err = (*func) (objfile, sym, stabs);
-// OBSOLETE        if (err)
-// OBSOLETE    error ("Internal error: unable to resolve stab.\n");
-// OBSOLETE      }
-
-// OBSOLETE    /* Restore our caller's state.  */
-// OBSOLETE    symbuf_idx = save_symbuf_idx;
-// OBSOLETE    symbuf_end = save_symbuf_end;
-// OBSOLETE    symnum = save_symnum;
-// OBSOLETE    cont_count = 0;
-// OBSOLETE  }
-#endif /* OBSOLETE CFront */
-
 /* Name of last function encountered.  Used in Solaris to approximate
    object file boundaries.  */
 static char *last_function_name;
@@ -1007,7 +891,7 @@ init_bincl_list (int number, struct objfile *objfile)
 {
   bincls_allocated = number;
   next_bincl = bincl_list = (struct header_file_location *)
-    xmmalloc (objfile->md, bincls_allocated * sizeof (struct header_file_location));
+    xmalloc (bincls_allocated * sizeof (struct header_file_location));
 }
 
 /* Add a bincl to the list.  */
@@ -1020,8 +904,8 @@ add_bincl_to_list (struct partial_symtab *pst, char *name, int instance)
       int offset = next_bincl - bincl_list;
       bincls_allocated *= 2;
       bincl_list = (struct header_file_location *)
-       xmrealloc (pst->objfile->md, (char *) bincl_list,
-                  bincls_allocated * sizeof (struct header_file_location));
+       xrealloc ((char *) bincl_list,
+                 bincls_allocated * sizeof (struct header_file_location));
       next_bincl = bincl_list + offset;
     }
   next_bincl->pst = pst;
@@ -1040,7 +924,7 @@ find_corresponding_bincl_psymtab (char *name, int instance)
 
   for (bincl = bincl_list; bincl < next_bincl; bincl++)
     if (bincl->instance == instance
-       && STREQ (name, bincl->name))
+       && strcmp (name, bincl->name) == 0)
       return bincl->pst;
 
   repeated_header_complaint (name, symnum);
@@ -1052,7 +936,7 @@ find_corresponding_bincl_psymtab (char *name, int instance)
 static void
 free_bincl_list (struct objfile *objfile)
 {
-  xmfree (objfile->md, bincl_list);
+  xfree (bincl_list);
   bincls_allocated = 0;
 }
 
@@ -1473,12 +1357,6 @@ read_dbx_symtab (struct objfile *objfile)
              || (namestring[(nsl = strlen (namestring)) - 1] == 'o'
                  && namestring[nsl - 2] == '.'))
          {
-           if (objfile->ei.entry_point < nlist.n_value &&
-               objfile->ei.entry_point >= last_o_file_start)
-             {
-               objfile->ei.deprecated_entry_file_lowpc = last_o_file_start;
-               objfile->ei.deprecated_entry_file_highpc = nlist.n_value;
-             }
            if (past_first_source_file && pst
                /* The gould NP1 uses low values for .o and -l symbols
                   which are not the address.  */
@@ -1578,6 +1456,7 @@ read_dbx_symtab (struct objfile *objfile)
            static int prev_so_symnum = -10;
            static int first_so_symnum;
            char *p;
+           static char *dirname_nso;
            int prev_textlow_not_set;
 
            valu = nlist.n_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
@@ -1635,18 +1514,27 @@ read_dbx_symtab (struct objfile *objfile)
 
            p = strrchr (namestring, '/');
            if (p && *(p + 1) == '\000')
-             continue;         /* Simply ignore directory name SOs */
+             {
+               /* Save the directory name SOs locally, then save it into
+                  the psymtab when it's created below. */
+               dirname_nso = namestring;
+               continue;               
+             }
 
            /* Some other compilers (C++ ones in particular) emit useless
               SOs for non-existant .c files.  We ignore all subsequent SOs that
               immediately follow the first.  */
 
            if (!pst)
+             {
              pst = start_psymtab (objfile,
                                   namestring, valu,
                                   first_so_symnum * symbol_size,
                                   objfile->global_psymbols.next,
                                   objfile->static_psymbols.next);
+               pst->dirname = dirname_nso;
+               dirname_nso = NULL;
+             }
            continue;
          }
 
@@ -1712,12 +1600,12 @@ read_dbx_symtab (struct objfile *objfile)
               things like "break c-exp.y:435" need to work (I
               suppose the psymtab_include_list could be hashed or put
               in a binary tree, if profiling shows this is a major hog).  */
-           if (pst && STREQ (namestring, pst->filename))
+           if (pst && strcmp (namestring, pst->filename) == 0)
            continue;
            {
-             register int i;
+             int i;
              for (i = 0; i < includes_used; i++)
-               if (STREQ (namestring, psymtab_include_list[i]))
+               if (strcmp (namestring, psymtab_include_list[i]) == 0)
                  {
                    i = -1;
                    break;
@@ -1838,22 +1726,6 @@ read_dbx_symtab (struct objfile *objfile)
                                         psymtab_language, objfile);
                    p += 1;
                  }
-#if 0 /* OBSOLETE CFront */
-// OBSOLETE            /* The semantics of C++ state that "struct foo { ... }"
-// OBSOLETE               also defines a typedef for "foo".  Unfortuantely, cfront
-// OBSOLETE               never makes the typedef when translating from C++ to C.
-// OBSOLETE               We make the typedef here so that "ptype foo" works as
-// OBSOLETE               expected for cfront translated code.  */
-// OBSOLETE            else if (psymtab_language == language_cplus)
-// OBSOLETE              {
-// OBSOLETE                /* Also a typedef with the same name.  */
-// OBSOLETE                add_psymbol_to_list (namestring, p - namestring,
-// OBSOLETE                                     VAR_DOMAIN, LOC_TYPEDEF,
-// OBSOLETE                                     &objfile->static_psymbols,
-// OBSOLETE                                     nlist.n_value, 0,
-// OBSOLETE                                     psymtab_language, objfile);
-// OBSOLETE              }
-#endif /* OBSOLETE CFront */
              }
            goto check_enum;
          case 't':
@@ -2088,11 +1960,6 @@ read_dbx_symtab (struct objfile *objfile)
          case '9':
          case '-':
          case '#':             /* for symbol identification (used in live ranges) */
-#if 0 /* OBSOLETE CFront */
-// OBSOLETE        /* added to support cfront stabs strings */
-// OBSOLETE      case 'Z':             /* for definition continuations */
-// OBSOLETE      case 'P':             /* for prototypes */
-#endif /* OBSOLETE CFront */
            continue;
 
          case ':':
@@ -2221,6 +2088,7 @@ read_dbx_symtab (struct objfile *objfile)
 
          case N_OBJ:                   /* useless types from Solaris */
          case N_OPT:
+         case N_PATCH:
          /* These symbols aren't interesting; don't worry about them */
 
          continue;
@@ -2228,22 +2096,12 @@ read_dbx_symtab (struct objfile *objfile)
          default:
          /* If we haven't found it yet, ignore it.  It's probably some
             new type we don't know about yet.  */
-         unknown_symtype_complaint (local_hex_string (nlist.n_type));
+         unknown_symtype_complaint (hex_string (nlist.n_type));
          continue;
        }
     }
 
   /* If there's stuff to be cleaned up, clean it up.  */
-  if (DBX_SYMCOUNT (objfile) > 0       /* We have some syms */
-      /*FIXME, does this have a bug at start address 0? */
-      && last_o_file_start
-      && objfile->ei.entry_point < nlist.n_value
-      && objfile->ei.entry_point >= last_o_file_start)
-    {
-      objfile->ei.deprecated_entry_file_lowpc = last_o_file_start;
-      objfile->ei.deprecated_entry_file_highpc = nlist.n_value;
-    }
-
   if (pst)
     {
       /* Don't set pst->texthigh lower than it already is.  */
@@ -2280,7 +2138,7 @@ start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
                        filename, textlow, global_syms, static_syms);
 
   result->read_symtab_private = (char *)
-    obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
+    obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc));
   LDSYMOFF (result) = ldsymoff;
   result->read_symtab = dbx_psymtab_to_symtab;
   SYMBOL_SIZE (result) = symbol_size;
@@ -2402,7 +2260,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
   if (number_dependencies)
     {
       pst->dependencies = (struct partial_symtab **)
-       obstack_alloc (&objfile->psymbol_obstack,
+       obstack_alloc (&objfile->objfile_obstack,
                    number_dependencies * sizeof (struct partial_symtab *));
       memcpy (pst->dependencies, dependency_list,
              number_dependencies * sizeof (struct partial_symtab *));
@@ -2418,7 +2276,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
       /* Copy the sesction_offsets array from the main psymtab. */
       subpst->section_offsets = pst->section_offsets;
       subpst->read_symtab_private =
-       (char *) obstack_alloc (&objfile->psymbol_obstack,
+       (char *) obstack_alloc (&objfile->objfile_obstack,
                                sizeof (struct symloc));
       LDSYMOFF (subpst) =
        LDSYMLEN (subpst) =
@@ -2428,7 +2286,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
       /* We could save slight bits of space by only making one of these,
          shared by the entire set of include files.  FIXME-someday.  */
       subpst->dependencies = (struct partial_symtab **)
-       obstack_alloc (&objfile->psymbol_obstack,
+       obstack_alloc (&objfile->objfile_obstack,
                       sizeof (struct partial_symtab *));
       subpst->dependencies[0] = pst;
       subpst->number_of_dependencies = 1;
@@ -2645,13 +2503,13 @@ read_ofile_symtab (struct partial_symtab *pst)
        {
          const char *tempstring = namestring;
 
-         if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
+         if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
            processing_gcc_compilation = 1;
-         else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
+         else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
            processing_gcc_compilation = 2;
          if (tempstring[0] == bfd_get_symbol_leading_char (symfile_bfd))
            ++tempstring;
-         if (STREQN (tempstring, "__gnu_compiled", 14))
+         if (DEPRECATED_STREQN (tempstring, "__gnu_compiled", 14))
            processing_gcc_compilation = 2;
        }
 
@@ -2717,9 +2575,9 @@ read_ofile_symtab (struct partial_symtab *pst)
             However, there is no reason not to accept
             the GCC_COMPILED_FLAG_SYMBOL anywhere.  */
 
-         if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
+         if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
            processing_gcc_compilation = 1;
-         else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
+         else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
            processing_gcc_compilation = 2;
 
 #if 0
@@ -2764,11 +2622,6 @@ read_ofile_symtab (struct partial_symtab *pst)
 
   pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
 
-#if 0 /* OBSOLETE CFront */
-// OBSOLETE    /* Process items which we had to "process_later" due to dependencies 
-// OBSOLETE       on other stabs.  */
-// OBSOLETE    process_now (objfile);
-#endif /* OBSOLETE CFront */
   end_stabs ();
 }
 \f
@@ -2794,17 +2647,6 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
                    struct section_offsets *section_offsets,
                    struct objfile *objfile)
 {
-#ifdef SUN_FIXED_LBRAC_BUG
-  /* If SUN_FIXED_LBRAC_BUG is defined, then it tells us whether we need
-     to correct the address of N_LBRAC's.  If it is not defined, then
-     we never need to correct the addresses.  */
-
-  /* This records the last pc address we've seen.  We depend on there being
-     an SLINE or FUN or SO before the first LBRAC, since the variable does
-     not get reset in between reads of different symbol files.  */
-  static CORE_ADDR last_pc_address;
-#endif
-
   struct context_stack *new;
   /* This remembers the address of the start of a function.  It is used
      because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries are
@@ -2912,14 +2754,6 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
           N_SO, the linker did not relocate them (sigh).  */
        valu += last_source_start_addr;
 
-#ifdef SUN_FIXED_LBRAC_BUG
-      if (!SUN_FIXED_LBRAC_BUG && valu < last_pc_address)
-       {
-         /* Patch current LBRAC pc value to match last handy pc value */
-         complaint (&symfile_complaints, "bad block start address patched");
-         valu = last_pc_address;
-       }
-#endif
       new = push_context (desc, valu);
       break;
 
@@ -3033,18 +2867,6 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 
       n_opt_found = 0;
 
-#ifdef SUN_FIXED_LBRAC_BUG
-      last_pc_address = valu;  /* Save for SunOS bug circumcision */
-#endif
-
-#ifdef PCC_SOL_BROKEN
-      /* pcc bug, occasionally puts out SO for SOL.  */
-      if (context_stack_depth > 0)
-       {
-         start_subfile (name, NULL);
-         break;
-       }
-#endif
       if (last_source_file)
        {
          /* Check if previous symbol was also an N_SO (with some
@@ -3105,9 +2927,6 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
       /* Relocate for dynamic loading and for ELF acc fn-relative syms.  */
       valu += function_start_offset;
 
-#ifdef SUN_FIXED_LBRAC_BUG
-      last_pc_address = valu;  /* Save for SunOS bug circumcision */
-#endif
       /* If this is the first SLINE note in the function, record it at
         the start of the function instead of at the listed location.  */
       if (within_function && sline_found_in_function == 0)
@@ -3218,7 +3037,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
     case N_NBBSS:
     case N_NBSTS:
     case N_NBLCS:
-      unknown_symtype_complaint (local_hex_string (type));
+      unknown_symtype_complaint (hex_string (type));
       /* FALLTHROUGH */
 
       /* The following symbol types don't need the address field relocated,
@@ -3267,56 +3086,6 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
                }
 #endif
 
-#ifdef SUN_FIXED_LBRAC_BUG
-             /* The Sun acc compiler, under SunOS4, puts out
-                functions with N_GSYM or N_STSYM.  The problem is
-                that the address of the symbol is no good (for N_GSYM
-                it doesn't even attept an address; for N_STSYM it
-                puts out an address but then it gets relocated
-                relative to the data segment, not the text segment).
-                Currently we can't fix this up later as we do for
-                some types of symbol in scan_file_globals.
-                Fortunately we do have a way of finding the address -
-                we know that the value in last_pc_address is either
-                the one we want (if we're dealing with the first
-                function in an object file), or somewhere in the
-                previous function. This means that we can use the
-                minimal symbol table to get the address.  */
-
-             /* Starting with release 3.0, the Sun acc compiler,
-                under SunOS4, puts out functions with N_FUN and a value
-                of zero. This gets relocated to the start of the text
-                segment of the module, which is no good either.
-                Under SunOS4 we can deal with this as N_SLINE and N_SO
-                entries contain valid absolute addresses.
-                Release 3.0 acc also puts out N_OPT entries, which makes
-                it possible to discern acc from cc or gcc.  */
-
-             if (type == N_GSYM || type == N_STSYM
-                 || (type == N_FUN
-                     && n_opt_found && !block_address_function_relative))
-               {
-                 struct minimal_symbol *m;
-                 int l = colon_pos - name;
-
-                 m = lookup_minimal_symbol_by_pc (last_pc_address);
-                 if (m && STREQN (DEPRECATED_SYMBOL_NAME (m), name, l)
-                     && DEPRECATED_SYMBOL_NAME (m)[l] == '\0')
-                   /* last_pc_address was in this function */
-                   valu = SYMBOL_VALUE (m);
-                 else if (m && DEPRECATED_SYMBOL_NAME (m + 1)
-                          && STREQN (DEPRECATED_SYMBOL_NAME (m + 1), name, l)
-                          && DEPRECATED_SYMBOL_NAME (m + 1)[l] == '\0')
-                   /* last_pc_address was in last function */
-                   valu = SYMBOL_VALUE (m + 1);
-                 else
-                   /* Not found - use last_pc_address (for finish_block) */
-                   valu = last_pc_address;
-               }
-
-             last_pc_address = valu;   /* Save for SunOS bug circumcision */
-#endif
-
              if (block_address_function_relative)
                /* For Solaris 2.0 compilers, the block addresses and
                   N_SLINE's are relative to the start of the
@@ -3360,7 +3129,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
     case N_OPT:                /* Solaris 2:  Compiler options */
       if (name)
        {
-         if (STREQ (name, GCC2_COMPILED_FLAG_SYMBOL))
+         if (strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0)
            {
              processing_gcc_compilation = 2;
 #if 0                          /* Works, but is experimental.  -fnf */
@@ -3392,6 +3161,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
 
       /* The following symbol types can be ignored.  */
     case N_OBJ:                /* Solaris 2:  Object file dir and name */
+    case N_PATCH:      /* Solaris2: Patch Run Time Checker.  */
       /*   N_UNDF:                   Solaris 2:  file separator mark */
       /*   N_UNDF: -- we will never encounter it, since we only process one
          file's symbols at once.  */
@@ -3481,7 +3251,7 @@ coffstab_build_psymtabs (struct objfile *objfile, int mainline,
   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);
+    obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
   OBJSTAT (objfile, sz_strtab += stabstrsize + 1);
 
   /* Now read in the string table in one big gulp.  */
@@ -3531,8 +3301,7 @@ coffstab_build_psymtabs (struct objfile *objfile, int mainline,
 }
 \f
 /* Scan and build partial symbols for an ELF symbol file.
-   This ELF file has already been processed to get its minimal symbols,
-   and any DWARF symbols that were in it.
+   This ELF file has already been processed to get its minimal symbols.
 
    This routine is the equivalent of dbx_symfile_init and dbx_symfile_read
    rolled into one.
@@ -3579,7 +3348,7 @@ elfstab_build_psymtabs (struct objfile *objfile, int mainline,
   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);
+    obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
   OBJSTAT (objfile, sz_strtab += stabstrsize + 1);
 
   /* Now read in the string table in one big gulp.  */
@@ -3673,7 +3442,7 @@ stabsect_build_psymtabs (struct objfile *objfile, int mainline, char *stab_name,
   if (DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
     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);
+    obstack_alloc (&objfile->objfile_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.  */