* configure.tgt (mips64*vr4320*el-*-elf*) : Removed spurious case.
[deliverable/binutils-gdb.git] / gdb / hpread.c
index ad142a8ea89cad983e338d81f84ef3fd150c47bf..0e4174600eeb0881a63da0b1eb9aa8b4c861e45a 100644 (file)
@@ -1,5 +1,5 @@
 /* Read hp debug symbols and convert to internal format, for GDB.
-   Copyright 1993 Free Software Foundation, Inc.
+   Copyright 1993, 1996 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
    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.
 
    Written by the Center for Software Science at the University of Utah
    and by Cygnus Support.  */
 
 #include "defs.h"
 #include "bfd.h"
-#include <string.h>
-#include "hpux-symtab.h"
+#include "gdb_string.h"
+#include "hp-symtab.h"
 #include "syms.h"
 #include "symtab.h"
 #include "symfile.h"
@@ -32,6 +32,7 @@
 #include "complaints.h"
 #include "gdb-stabs.h"
 #include "gdbtypes.h"
+#include "demangle.h"
 
 /* Private information attached to an objfile which we use to find
    and internalize the HP C debug symbols within that objfile.  */
@@ -57,7 +58,7 @@ struct hpread_symfile_info
   int type_vector_length;
 
   /* Keeps track of the beginning of a range of source lines.  */
-  SLTPOINTER sl_index;
+  sltpointer sl_index;
 
   /* Some state variables we'll need.  */
   int within_function;
@@ -65,7 +66,6 @@ struct hpread_symfile_info
   /* Keep track of the current function's address.  We may need to look
      up something based on this address.  */
   unsigned int current_function_value;
-
 };
 
 /* Accessor macros to get at the fields.  */
@@ -100,29 +100,30 @@ struct hpread_symfile_info
     } \
   else \
     *NAMEP = (SYM)->dsfile.name + VT (OBJFILE)
-
-/* Each partial symbol table entry contains a pointer to private data for the
-   read_symtab() function to use when expanding a partial symbol table entry
-   to a full symbol table entry.
-
-   For hpuxread this structure contains the offset within the file symbol table
-   of first local symbol for this file, and length (in bytes) of the section
-   of the symbol table devoted to this file's symbols (actually, the section
-   bracketed may contain more than just this file's symbols).
-
-   If ldsymlen is 0, the only reason for this thing's existence is the
-   dependency list.  Nothing else will happen when it is read in.  */
-
-#define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
-#define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
-#define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))
+\f
+/* We put a pointer to this structure in the read_symtab_private field
+   of the psymtab.  */
 
 struct symloc
 {
+  /* The offset within the file symbol table of first local symbol for
+     this file.  */
+
   int ldsymoff;
+
+  /* Length (in bytes) of the section of the symbol table devoted to
+     this file's symbols (actually, the section bracketed may contain
+     more than just this file's symbols).  If ldsymlen is 0, the only
+     reason for this thing's existence is the dependency list.
+     Nothing else will happen when it is read in.  */
+
   int ldsymlen;
 };
 
+#define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
+#define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
+#define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))
+\f
 /* FIXME: Shouldn't this stuff be in a .h file somewhere?  */
 /* Nonzero means give verbose info on gdb action.  */
 extern int info_verbose;
@@ -135,23 +136,26 @@ extern struct complaint lbrac_mismatch_complaint;
 \f
 void hpread_symfile_init  PARAMS ((struct objfile *));
 
+static struct type *
+hpread_read_array_type PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+
 static struct type *hpread_alloc_type
-  PARAMS ((DNTTPOINTER, struct objfile *));
+  PARAMS ((dnttpointer, struct objfile *));
 
 static struct type **hpread_lookup_type
-  PARAMS ((DNTTPOINTER, struct objfile *));
+  PARAMS ((dnttpointer, struct objfile *));
 
 static struct type *hpread_read_enum_type
-  PARAMS ((DNTTPOINTER, union dnttentry *, struct objfile *));
+  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
 
 static struct type *hpread_read_set_type
-  PARAMS ((DNTTPOINTER, union dnttentry *, struct objfile *));
+  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
 
 static struct type *hpread_read_subrange_type
-  PARAMS ((DNTTPOINTER, union dnttentry *, struct objfile *));
+  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
 
 static struct type *hpread_read_struct_type
-  PARAMS ((DNTTPOINTER, union dnttentry *, struct objfile *));
+  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
 
 void hpread_build_psymtabs
   PARAMS ((struct objfile *, struct section_offsets *, int));
@@ -160,7 +164,7 @@ void hpread_symfile_finish PARAMS ((struct objfile *));
 
 static struct partial_symtab *hpread_start_psymtab
   PARAMS ((struct objfile *, struct section_offsets *, char *, CORE_ADDR, int,
-          struct partial_symbol *, struct partial_symbol *));
+          struct partial_symbol **, struct partial_symbol **));
 
 static struct partial_symtab *hpread_end_psymtab
   PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
@@ -174,32 +178,33 @@ static void hpread_process_one_debug_symbol
   PARAMS ((union dnttentry *, char *, struct section_offsets *,
           struct objfile *, CORE_ADDR, int, char *, int));
 
-static SLTPOINTER hpread_record_lines
-  PARAMS ((struct subfile *, SLTPOINTER, SLTPOINTER, struct objfile *));
+static sltpointer hpread_record_lines
+  PARAMS ((struct subfile *, sltpointer, sltpointer,
+          struct objfile *, CORE_ADDR));
 
 static struct type *hpread_read_function_type
-  PARAMS ((DNTTPOINTER, union dnttentry *, struct objfile *));
+  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
 
 static struct type * hpread_type_lookup
-  PARAMS ((DNTTPOINTER, struct objfile *));
+  PARAMS ((dnttpointer, struct objfile *));
 
 static unsigned long hpread_get_depth
-  PARAMS ((SLTPOINTER, struct objfile *));
+  PARAMS ((sltpointer, struct objfile *));
 
 static unsigned long hpread_get_line
-  PARAMS ((SLTPOINTER, struct objfile *));
+  PARAMS ((sltpointer, struct objfile *));
 
-static ADDRESS hpread_get_location
-  PARAMS ((SLTPOINTER, struct objfile *));
+static CORE_ADDR hpread_get_location
+  PARAMS ((sltpointer, struct objfile *));
 
-static int hpread_type_translate PARAMS ((DNTTPOINTER));
+static int hpread_type_translate PARAMS ((dnttpointer));
 static unsigned long hpread_get_textlow PARAMS ((int, int, struct objfile *));
 static union dnttentry *hpread_get_gntt PARAMS ((int, struct objfile *));
 static union dnttentry *hpread_get_lntt PARAMS ((int, struct objfile *));
 static union sltentry *hpread_get_slt PARAMS ((int, struct objfile *));
 static void hpread_psymtab_to_symtab PARAMS ((struct partial_symtab *));
 static void hpread_psymtab_to_symtab_1 PARAMS ((struct partial_symtab *));
-static int hpread_has_name PARAMS ((KINDTYPE));
+static int hpread_has_name PARAMS ((enum dntt_entry_type));
 
 \f
 /* Initialization for reading native HP C debug symbols from OBJFILE.
@@ -207,7 +212,7 @@ static int hpread_has_name PARAMS ((KINDTYPE));
    It's only purpose in life is to set up the symbol reader's private
    per-objfile data structures, and read in the raw contents of the debug
    sections (attaching pointers to the debug info into the private data
-   structures.
+   structures).
 
    Since BFD doesn't know how to read debug symbols in a format-independent
    way (and may never do so...), we have to do it ourselves.  Note we may
@@ -241,7 +246,8 @@ hpread_symfile_init (objfile)
                            0, bfd_section_size (objfile->obfd, gntt_section));
 
   GNTT_SYMCOUNT (objfile)
-    = bfd_section_size (objfile->obfd, gntt_section) / DNTTBLOCKSIZE;
+    = bfd_section_size (objfile->obfd, gntt_section)
+                       / sizeof (struct dntt_type_block);
 
   /* Read in data from the $LNTT$ subspace.   Also keep track of the number
      of LNTT symbols.  */
@@ -257,7 +263,8 @@ hpread_symfile_init (objfile)
                            0, bfd_section_size (objfile->obfd, lntt_section));
 
   LNTT_SYMCOUNT (objfile)
-    = bfd_section_size (objfile->obfd, lntt_section) / DNTTBLOCKSIZE;
+    = bfd_section_size (objfile->obfd, lntt_section)
+                       / sizeof (struct dntt_type_block);
 
   /* Read in data from the $SLT$ subspace.  $SLT$ contains information
      on source line numbers.  */
@@ -333,7 +340,7 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
   int dependencies_used, dependencies_allocated;
 
   /* Just in case the stabs reader left turds lying around.  */
-  pending_blocks = 0;
+  free_pending_blocks ();
   make_cleanup (really_free_pendings, 0);
 
   pst = (struct partial_symtab *) 0;
@@ -383,7 +390,7 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
             everything else is ignored.  */
          switch (dn_bufp->dblock.kind)
            {
-           case K_SRCFILE:
+           case DNTT_TYPE_SRCFILE:
              {
                /* A source file of some kind.  Note this may simply
                   be an included file.  */
@@ -447,10 +454,11 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
 
                if (pst && past_first_source_file)
                  {
-                   texthigh += ANOFFSET (section_offsets, SECT_OFF_TEXT);
                    hpread_end_psymtab (pst, psymtab_include_list,
                                        includes_used,
-                                       hp_symnum * DNTTBLOCKSIZE, texthigh,
+                                       (hp_symnum
+                                        * sizeof (struct dntt_type_block)),
+                                       texthigh,
                                        dependency_list, dependencies_used);
                    pst = (struct partial_symtab *) 0;
                    includes_used = 0;
@@ -463,7 +471,8 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
                valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
                pst = hpread_start_psymtab (objfile, section_offsets,
                                            namestring, valu,
-                                           hp_symnum * DNTTBLOCKSIZE,
+                                           (hp_symnum
+                                            * sizeof (struct dntt_type_block)),
                                            objfile->global_psymbols.next,
                                            objfile->static_psymbols.next);
                texthigh = valu;
@@ -471,9 +480,9 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
                continue;
              }
 
-           case K_MODULE:
+           case DNTT_TYPE_MODULE:
              /* A source file.  It's still unclear to me what the
-                real difference between a K_SRCFILE and K_MODULE
+                real difference between a DNTT_TYPE_SRCFILE and DNTT_TYPE_MODULE
                 is supposed to be.  */
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              valu = hpread_get_textlow (i, hp_symnum, objfile);
@@ -482,74 +491,78 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
                {
                  pst = hpread_start_psymtab (objfile, section_offsets,
                                              namestring, valu,
-                                             hp_symnum * DNTTBLOCKSIZE,
+                                             (hp_symnum
+                                              * sizeof (struct dntt_type_block)),
                                              objfile->global_psymbols.next,
                                              objfile->static_psymbols.next);
                  texthigh = valu;
                  have_name = 0;
                }
              continue;
-           case K_FUNCTION:
-           case K_ENTRY:
-             /* The beginning of a function.  K_ENTRY may also denote
+           case DNTT_TYPE_FUNCTION:
+           case DNTT_TYPE_ENTRY:
+             /* The beginning of a function.  DNTT_TYPE_ENTRY may also denote
                 a secondary entry point.  */
+             valu = dn_bufp->dfunc.hiaddr + ANOFFSET (section_offsets,
+                                                      SECT_OFF_TEXT);
+             if (valu > texthigh)
+               texthigh = valu;
              valu = dn_bufp->dfunc.lowaddr +
                ANOFFSET (section_offsets, SECT_OFF_TEXT);
-             if (dn_bufp->dfunc.hiaddr > texthigh)
-               texthigh = dn_bufp->dfunc.hiaddr;
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
-             ADD_PSYMBOL_TO_LIST (namestring, strlen (namestring),
+             add_psymbol_to_list (namestring, strlen (namestring),
                                   VAR_NAMESPACE, LOC_BLOCK,
-                                  objfile->static_psymbols, valu,
-                                  language_unknown, objfile);
+                                  &objfile->static_psymbols, valu,
+                                  0, language_unknown, objfile);
              within_function = 1;
              continue;
-           case K_BEGIN:
-           case K_END:
+           case DNTT_TYPE_BEGIN:
+           case DNTT_TYPE_END:
              /* Scope block begin/end.  We only care about function
                 and file blocks right now.  */
-             if (dn_bufp->dend.endkind == K_MODULE)
+             if (dn_bufp->dend.endkind == DNTT_TYPE_MODULE)
                {
-                 texthigh += ANOFFSET (section_offsets, SECT_OFF_TEXT);
                  hpread_end_psymtab (pst, psymtab_include_list, includes_used,
-                                     hp_symnum * DNTTBLOCKSIZE, texthigh,
+                                     (hp_symnum
+                                      * sizeof (struct dntt_type_block)),
+                                     texthigh,
                                      dependency_list, dependencies_used);
                  pst = (struct partial_symtab *) 0;
                  includes_used = 0;
                  dependencies_used = 0;
                  have_name = 0;
                }
-             if (dn_bufp->dend.endkind == K_FUNCTION)
+             if (dn_bufp->dend.endkind == DNTT_TYPE_FUNCTION)
                within_function = 0;
              continue;
-           case K_SVAR:
-           case K_DVAR:
-           case K_TYPEDEF:
-           case K_TAGDEF:
+           case DNTT_TYPE_SVAR:
+           case DNTT_TYPE_DVAR:
+           case DNTT_TYPE_TYPEDEF:
+           case DNTT_TYPE_TAGDEF:
              {
                /* Variables, typedefs an the like.  */
                enum address_class storage;
-               enum namespace namespace;
+               namespace_enum namespace;
 
                /* Don't add locals to the partial symbol table.  */
                if (within_function
-                   && (dn_bufp->dblock.kind == K_SVAR
-                       || dn_bufp->dblock.kind == K_DVAR))
+                   && (dn_bufp->dblock.kind == DNTT_TYPE_SVAR
+                       || dn_bufp->dblock.kind == DNTT_TYPE_DVAR))
                  continue;
 
                /* TAGDEFs go into the structure namespace.  */
-               if (dn_bufp->dblock.kind == K_TAGDEF)
+               if (dn_bufp->dblock.kind == DNTT_TYPE_TAGDEF)
                  namespace = STRUCT_NAMESPACE;
                else
                  namespace = VAR_NAMESPACE;
 
                /* What kind of "storage" does this use?  */
-               if (dn_bufp->dblock.kind == K_SVAR)
+               if (dn_bufp->dblock.kind == DNTT_TYPE_SVAR)
                  storage = LOC_STATIC;
-               else if (dn_bufp->dblock.kind == K_DVAR
+               else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR
                         && dn_bufp->ddvar.regvar)
                  storage = LOC_REGISTER;
-               else if (dn_bufp->dblock.kind == K_DVAR)
+               else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR)
                  storage = LOC_LOCAL;
                else
                  storage = LOC_UNDEF;
@@ -559,44 +572,46 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
                  {
                    pst = hpread_start_psymtab (objfile, section_offsets,
                                                "globals", 0,
-                                               hp_symnum * DNTTBLOCKSIZE,
+                                               (hp_symnum
+                                                * sizeof (struct dntt_type_block)),
                                                objfile->global_psymbols.next,
                                                objfile->static_psymbols.next);
                  }
-               if (dn_bufp->dsvar.public)
+               if (dn_bufp->dsvar.global)
                  {
-                   ADD_PSYMBOL_TO_LIST (namestring, strlen (namestring),
+                   add_psymbol_to_list (namestring, strlen (namestring),
                                         namespace, storage,
-                                        objfile->global_psymbols,
+                                        &objfile->global_psymbols,
                                         dn_bufp->dsvar.location,
-                                        language_unknown, objfile);
+                                        0, language_unknown, objfile);
                  }
                else
                  {
-                   ADD_PSYMBOL_TO_LIST (namestring, strlen (namestring),
+                   add_psymbol_to_list (namestring, strlen (namestring),
                                         namespace, storage,
-                                        objfile->static_psymbols,
+                                        &objfile->static_psymbols,
                                         dn_bufp->dsvar.location,
-                                        language_unknown, objfile);
+                                        0, language_unknown, objfile);
                  }
                continue;
              }
-           case K_MEMENUM:
-           case K_CONST:
+           case DNTT_TYPE_MEMENUM:
+           case DNTT_TYPE_CONST:
              /* Constants and members of enumerated types.  */
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              if (!pst)
                {
                  pst = hpread_start_psymtab (objfile, section_offsets,
                                              "globals", 0,
-                                             hp_symnum * DNTTBLOCKSIZE,
+                                             (hp_symnum 
+                                              * sizeof (struct dntt_type_block)),
                                              objfile->global_psymbols.next,
                                              objfile->static_psymbols.next);
                }
-             ADD_PSYMBOL_TO_LIST (namestring, strlen (namestring),
+             add_psymbol_to_list (namestring, strlen (namestring),
                                   VAR_NAMESPACE, LOC_CONST,
-                                  objfile->static_psymbols, 0,
-                                  language_unknown, objfile);
+                                  &objfile->static_psymbols, 0,
+                                  0, language_unknown, objfile);
              continue;
            default:
              continue;
@@ -608,8 +623,8 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
   if (pst)
     {
       hpread_end_psymtab (pst, psymtab_include_list, includes_used,
-                         hp_symnum * DNTTBLOCKSIZE, 0,
-                         dependency_list, dependencies_used);
+                         hp_symnum * sizeof (struct dntt_type_block),
+                         0, dependency_list, dependencies_used);
     }
 
   discard_cleanups (old_chain);
@@ -640,7 +655,8 @@ hpread_get_lntt (index, objfile)
      int index;
      struct objfile *objfile;
 {
-  return (union dnttentry *)&(LNTT (objfile)[index * DNTTBLOCKSIZE]);
+  return (union dnttentry *)
+    &(LNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
 }
 
 static union dnttentry *
@@ -648,7 +664,8 @@ hpread_get_gntt (index, objfile)
      int index;
      struct objfile *objfile;
 {
-  return (union dnttentry *)&(GNTT (objfile)[index * DNTTBLOCKSIZE]);
+  return (union dnttentry *)
+    &(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
 }
 
 static union sltentry *
@@ -656,13 +673,13 @@ hpread_get_slt (index, objfile)
      int index;
      struct objfile *objfile;
 {
-  return (union sltentry *)&(SLT (objfile)[index * SLTBLOCKSIZE]);
+  return (union sltentry *)&(SLT (objfile)[index * sizeof (union sltentry)]);
 }
 
 /* Get the low address associated with some symbol (typically the start
    of a particular source file or module).  Since that information is not
-   stored as part of the K_MODULE or K_SRCFILE symbol we must infer it from
-   the existance of K_FUNCTION symbols.  */
+   stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we must infer it from
+   the existance of DNTT_TYPE_FUNCTION symbols.  */
 
 static unsigned long
 hpread_get_textlow (global, index, objfile)
@@ -673,23 +690,23 @@ hpread_get_textlow (global, index, objfile)
   union dnttentry *dn_bufp;
   struct minimal_symbol *msymbol;
 
-  /* Look for a K_FUNCTION symbol.  */
+  /* Look for a DNTT_TYPE_FUNCTION symbol.  */
   do
     {
       if (global)
        dn_bufp = hpread_get_gntt (index++, objfile);
       else
        dn_bufp = hpread_get_lntt (index++, objfile);
-    } while (dn_bufp->dblock.kind != K_FUNCTION
-            && dn_bufp->dblock.kind != K_END);
+    } while (dn_bufp->dblock.kind != DNTT_TYPE_FUNCTION
+            && dn_bufp->dblock.kind != DNTT_TYPE_END);
 
-  /* Avoid going past a K_END when looking for a K_FUNCTION.  This
+  /* Avoid going past a DNTT_TYPE_END when looking for a DNTT_TYPE_FUNCTION.  This
      might happen when a sourcefile has no functions.  */
-  if (dn_bufp->dblock.kind == K_END)
+  if (dn_bufp->dblock.kind == DNTT_TYPE_END)
     return 0;
 
   /* The minimal symbols are typically more accurate for some reason.  */
-  msymbol = lookup_minimal_symbol (dn_bufp->dfunc.name + VT (objfile),
+  msymbol = lookup_minimal_symbol (dn_bufp->dfunc.name + VT (objfile), NULL,
                                   objfile);
   if (msymbol)
     return SYMBOL_VALUE_ADDRESS (msymbol);
@@ -701,7 +718,7 @@ hpread_get_textlow (global, index, objfile)
 
 static unsigned long
 hpread_get_depth (index, objfile)
-     SLTPOINTER index;
+     sltpointer index;
      struct objfile *objfile;
 {
   union sltentry *sl_bufp;
@@ -714,7 +731,7 @@ hpread_get_depth (index, objfile)
 
 static unsigned long
 hpread_get_line (index, objfile)
-     SLTPOINTER index;
+     sltpointer index;
      struct objfile *objfile;
 {
   union sltentry *sl_bufp;
@@ -723,9 +740,9 @@ hpread_get_line (index, objfile)
   return sl_bufp->snorm.line;
 }
 
-static ADDRESS
+static CORE_ADDR
 hpread_get_location (index, objfile)
-     SLTPOINTER index;
+     sltpointer index;
      struct objfile *objfile;
 {
   union sltentry *sl_bufp;
@@ -756,44 +773,44 @@ hpread_get_location (index, objfile)
 
 static int
 hpread_has_name (kind)
-     KINDTYPE kind;
+     enum dntt_entry_type kind;
 {
   switch (kind)
     {
-    case K_SRCFILE:
-    case K_MODULE:
-    case K_FUNCTION:
-    case K_ENTRY:
-    case K_IMPORT:
-    case K_LABEL:
-    case K_FPARAM:
-    case K_SVAR:
-    case K_DVAR:
-    case K_CONST:
-    case K_TYPEDEF:
-    case K_TAGDEF:
-    case K_MEMENUM:
-    case K_FIELD:
-    case K_SA:
+    case DNTT_TYPE_SRCFILE:
+    case DNTT_TYPE_MODULE:
+    case DNTT_TYPE_FUNCTION:
+    case DNTT_TYPE_ENTRY:
+    case DNTT_TYPE_IMPORT:
+    case DNTT_TYPE_LABEL:
+    case DNTT_TYPE_FPARAM:
+    case DNTT_TYPE_SVAR:
+    case DNTT_TYPE_DVAR:
+    case DNTT_TYPE_CONST:
+    case DNTT_TYPE_TYPEDEF:
+    case DNTT_TYPE_TAGDEF:
+    case DNTT_TYPE_MEMENUM:
+    case DNTT_TYPE_FIELD:
+    case DNTT_TYPE_SA:
       return 1;
 
-    case K_BEGIN:
-    case K_END:
-    case K_WITH:
-    case K_COMMON:
-    case K_POINTER:
-    case K_ENUM:
-    case K_SET:
-    case K_SUBRANGE:
-    case K_ARRAY:
-    case K_STRUCT:
-    case K_UNION:
-    case K_VARIANT:
-    case K_FILE:
-    case K_FUNCTYPE:
-    case K_COBSTRUCT:
-    case K_XREF:
-    case K_MACRO:
+    case DNTT_TYPE_BEGIN:
+    case DNTT_TYPE_END:
+    case DNTT_TYPE_WITH:
+    case DNTT_TYPE_COMMON:
+    case DNTT_TYPE_POINTER:
+    case DNTT_TYPE_ENUM:
+    case DNTT_TYPE_SET:
+    case DNTT_TYPE_SUBRANGE:
+    case DNTT_TYPE_ARRAY:
+    case DNTT_TYPE_STRUCT:
+    case DNTT_TYPE_UNION:
+    case DNTT_TYPE_VARIANT:
+    case DNTT_TYPE_FILE:
+    case DNTT_TYPE_FUNCTYPE:
+    case DNTT_TYPE_COBSTRUCT:
+    case DNTT_TYPE_XREF:
+    case DNTT_TYPE_MACRO:
     default:
       return 0;
     }
@@ -814,8 +831,8 @@ hpread_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,
@@ -921,21 +938,8 @@ hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
         is wrong, in that a psymtab with N_SLINE entries but nothing else
         is not empty, but we don't realize that.  Fixing that without slowing
         things down might be tricky.  */
-      struct partial_symtab *prev_pst;
 
-      /* First, snip it out of the psymtab chain */
-
-      if (pst->objfile->psymtabs == pst)
-       pst->objfile->psymtabs = pst->next;
-      else
-       for (prev_pst = pst->objfile->psymtabs; prev_pst; prev_pst = pst->next)
-         if (prev_pst->next == pst)
-           prev_pst->next = pst->next;
-
-      /* Next, put it on a free list for recycling */
-
-      pst->next = pst->objfile->free_psymtabs;
-      pst->objfile->free_psymtabs = pst;
+      discard_psymtab (pst);
 
       /* Indicate that psymtab was thrown away.  */
       pst = (struct partial_symtab *)NULL;
@@ -1068,7 +1072,7 @@ hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
   union dnttentry *dn_bufp;
   unsigned max_symnum;
 
-  int sym_index = sym_offset / DNTTBLOCKSIZE;
+  int sym_index = sym_offset / sizeof (struct dntt_type_block);
 
   current_objfile = objfile;
   subfile_stack = 0;
@@ -1076,11 +1080,14 @@ hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
   last_source_file = 0;
 
   dn_bufp = hpread_get_lntt (sym_index, objfile);
-  if (!((dn_bufp->dblock.kind == (unsigned char) K_SRCFILE) ||
-       (dn_bufp->dblock.kind == (unsigned char) K_MODULE)))
-    start_symtab ("globals", NULL, 0);
+  if (!((dn_bufp->dblock.kind == (unsigned char) DNTT_TYPE_SRCFILE) ||
+       (dn_bufp->dblock.kind == (unsigned char) DNTT_TYPE_MODULE)))
+    {
+      start_symtab ("globals", NULL, 0);
+      record_debugformat ("HP");
+    }
 
-  max_symnum = sym_size / DNTTBLOCKSIZE;
+  max_symnum = sym_size / sizeof (struct dntt_type_block);
 
   /* Read in and process each debug symbol within the specified range.  */
   for (symnum = 0;
@@ -1103,7 +1110,7 @@ hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
 
   current_objfile = NULL;
 
-  return end_symtab (text_offset + text_size, 0, 0, objfile, 0);
+  return end_symtab (text_offset + text_size, objfile, 0);
 }
 \f
 
@@ -1111,22 +1118,22 @@ hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
 
 static int
 hpread_type_translate (typep)
-     DNTTPOINTER typep;
+     dnttpointer typep;
 {
   if (!typep.dntti.immediate)
     abort ();
 
   switch (typep.dntti.type)
     {
-    case T_BOOLEAN:
-    case T_BOOLEAN_S300_COMPAT:
-    case T_BOOLEAN_VAX_COMPAT:
+    case HP_TYPE_BOOLEAN:
+    case HP_TYPE_BOOLEAN_S300_COMPAT:
+    case HP_TYPE_BOOLEAN_VAX_COMPAT:
       return FT_BOOLEAN;
       /* Ugh.  No way to distinguish between signed and unsigned chars.  */
-    case T_CHAR:
-    case T_WIDE_CHAR:
+    case HP_TYPE_CHAR:
+    case HP_TYPE_WIDE_CHAR:
       return FT_CHAR;
-    case T_INT:
+    case HP_TYPE_INT:
       if (typep.dntti.bitlength <= 8)
        return FT_CHAR;
       if (typep.dntti.bitlength <= 16)
@@ -1134,9 +1141,9 @@ hpread_type_translate (typep)
       if (typep.dntti.bitlength <= 32)
        return FT_INTEGER;
       return FT_LONG_LONG;
-    case T_LONG:
+    case HP_TYPE_LONG:
       return FT_LONG;
-    case T_UNS_LONG:
+    case HP_TYPE_UNSIGNED_LONG:
       if (typep.dntti.bitlength <= 8)
        return FT_UNSIGNED_CHAR;
       if (typep.dntti.bitlength <= 16)
@@ -1144,7 +1151,7 @@ hpread_type_translate (typep)
       if (typep.dntti.bitlength <= 32)
        return FT_UNSIGNED_LONG;
       return FT_UNSIGNED_LONG_LONG;
-    case T_UNS_INT:
+    case HP_TYPE_UNSIGNED_INT:
       if (typep.dntti.bitlength <= 8)
        return FT_UNSIGNED_CHAR;
       if (typep.dntti.bitlength <= 16)
@@ -1152,28 +1159,28 @@ hpread_type_translate (typep)
       if (typep.dntti.bitlength <= 32)
        return FT_UNSIGNED_INTEGER;
       return FT_UNSIGNED_LONG_LONG;
-    case T_REAL:
-    case T_REAL_3000:
-    case T_DOUBLE:
+    case HP_TYPE_REAL:
+    case HP_TYPE_REAL_3000:
+    case HP_TYPE_DOUBLE:
       if (typep.dntti.bitlength == 64)
        return FT_DBL_PREC_FLOAT;
       if (typep.dntti.bitlength == 128)
        return FT_EXT_PREC_FLOAT;
       return FT_FLOAT;
-    case T_COMPLEX:
-    case T_COMPLEXS3000:
+    case HP_TYPE_COMPLEX:
+    case HP_TYPE_COMPLEXS3000:
       if (typep.dntti.bitlength == 128)
        return FT_DBL_PREC_COMPLEX;
       if (typep.dntti.bitlength == 192)
        return FT_EXT_PREC_COMPLEX;
       return FT_COMPLEX;
-    case T_STRING200:
-    case T_LONGSTRING200:
-    case T_FTN_STRING_SPEC:
-    case T_MOD_STRING_SPEC:
-    case T_MOD_STRING_3000:
-    case T_FTN_STRING_S300_COMPAT:
-    case T_FTN_STRING_VAX_COMPAT:
+    case HP_TYPE_STRING200:
+    case HP_TYPE_LONGSTRING200:
+    case HP_TYPE_FTN_STRING_SPEC:
+    case HP_TYPE_MOD_STRING_SPEC:
+    case HP_TYPE_MOD_STRING_3000:
+    case HP_TYPE_FTN_STRING_S300_COMPAT:
+    case HP_TYPE_FTN_STRING_VAX_COMPAT:
       return FT_STRING;
     default:
       abort ();
@@ -1184,7 +1191,7 @@ hpread_type_translate (typep)
 
 static struct type **
 hpread_lookup_type (hp_type, objfile)
-     DNTTPOINTER hp_type;
+     dnttpointer hp_type;
      struct objfile *objfile;
 {
   unsigned old_len;
@@ -1202,12 +1209,14 @@ hpread_lookup_type (hp_type, objfile)
            {
              TYPE_VECTOR_LENGTH (objfile) = 100;
              TYPE_VECTOR (objfile) = (struct type **)
-               malloc (TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *));
+               xmmalloc (objfile -> md,
+                         TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *));
            }
          while (index >= TYPE_VECTOR_LENGTH (objfile))
            TYPE_VECTOR_LENGTH (objfile) *= 2;
          TYPE_VECTOR (objfile) = (struct type **)
-           xrealloc ((char *) TYPE_VECTOR (objfile),
+           xmrealloc (objfile -> md,
+                      (char *) TYPE_VECTOR (objfile),
                      (TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *)));
          memset (&TYPE_VECTOR (objfile)[old_len], 0,
                  (TYPE_VECTOR_LENGTH (objfile) - old_len) *
@@ -1225,7 +1234,7 @@ hpread_lookup_type (hp_type, objfile)
 
 static struct type *
 hpread_alloc_type (hp_type, objfile)
-     DNTTPOINTER hp_type;
+     dnttpointer hp_type;
      struct objfile *objfile;
 {
   struct type **type_addr;
@@ -1243,14 +1252,14 @@ hpread_alloc_type (hp_type, objfile)
 
 static struct type *
 hpread_read_enum_type (hp_type, dn_bufp, objfile)
-     DNTTPOINTER hp_type;
+     dnttpointer hp_type;
      union dnttentry *dn_bufp;
      struct objfile *objfile;
 {
   struct type *type;
   struct pending **symlist, *osyms, *syms;
   int o_nsyms, nsyms = 0;
-  DNTTPOINTER mem;
+  dnttpointer mem;
   union dnttentry *memp;
   char *name;
   long n;
@@ -1273,7 +1282,8 @@ hpread_read_enum_type (hp_type, dn_bufp, objfile)
       sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                             sizeof (struct symbol));
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = name;
+      SYMBOL_NAME (sym) = obsavestring (name, strlen (name), 
+                                       &objfile->symbol_obstack);
       SYMBOL_CLASS (sym) = LOC_CONST;
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       SYMBOL_VALUE (sym) = memp->dmember.value;
@@ -1307,7 +1317,6 @@ hpread_read_enum_type (hp_type, dn_bufp, objfile)
          struct symbol *xsym = syms->symbol[j];
          SYMBOL_TYPE (xsym) = type;
          TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
-         TYPE_FIELD_VALUE (type, n) = 0;
          TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
          TYPE_FIELD_BITSIZE (type, n) = 0;
        }
@@ -1322,14 +1331,14 @@ hpread_read_enum_type (hp_type, dn_bufp, objfile)
 
 static struct type *
 hpread_read_function_type (hp_type, dn_bufp, objfile)
-     DNTTPOINTER hp_type;
+     dnttpointer hp_type;
      union dnttentry *dn_bufp;
      struct objfile *objfile;
 {
   struct type *type, *type1;
   struct pending **symlist, *osyms, *syms;
   int o_nsyms, nsyms = 0;
-  DNTTPOINTER param;
+  dnttpointer param;
   union dnttentry *paramp;
   char *name;
   long n;
@@ -1364,7 +1373,8 @@ hpread_read_function_type (hp_type, dn_bufp, objfile)
       sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                             sizeof (struct symbol));
       (void) memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = name;
+      SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
+                                       &objfile->symbol_obstack);
 
       /* Figure out where it lives.  */
       if (paramp->dfparam.regparam)
@@ -1431,7 +1441,7 @@ hpread_read_function_type (hp_type, dn_bufp, objfile)
 
 static struct type *
 hpread_read_struct_type (hp_type, dn_bufp, objfile)
-     DNTTPOINTER hp_type;
+     dnttpointer hp_type;
      union dnttentry *dn_bufp;
      struct objfile *objfile;
 {
@@ -1445,7 +1455,7 @@ hpread_read_struct_type (hp_type, dn_bufp, objfile)
   struct nextfield *list = 0;
   struct nextfield *new;
   int n, nfields = 0;
-  DNTTPOINTER field;
+  dnttpointer field;
   union dnttentry *fieldp;
 
   /* Is it something we've already dealt with?  */
@@ -1455,12 +1465,12 @@ hpread_read_struct_type (hp_type, dn_bufp, objfile)
       return type;
 
   /* Get the basic type correct.  */
-  if (dn_bufp->dblock.kind == K_STRUCT)
+  if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT)
     {
       TYPE_CODE (type) = TYPE_CODE_STRUCT;
       TYPE_LENGTH (type) = dn_bufp->dstruct.bitlength / 8;
     }
-  else if (dn_bufp->dblock.kind == K_UNION)
+  else if (dn_bufp->dblock.kind == DNTT_TYPE_UNION)
     {
       TYPE_CODE (type) = TYPE_CODE_UNION;
       TYPE_LENGTH (type) = dn_bufp->dunion.bitlength / 8;
@@ -1483,14 +1493,15 @@ hpread_read_struct_type (hp_type, dn_bufp, objfile)
       list = new;
 
       list->field.name = VT (objfile) + fieldp->dfield.name;
-      list->field.bitpos = fieldp->dfield.bitoffset;
+      FIELD_BITPOS (list->field) = fieldp->dfield.bitoffset;
       if (fieldp->dfield.bitlength % 8)
-       list->field.bitsize = fieldp->dfield.bitlength;
+       FIELD_BITSIZE (list->field) = fieldp->dfield.bitlength;
       else
-       list->field.bitsize = 0;
+       FIELD_BITSIZE (list->field) = 0;
       nfields++;
       field = fieldp->dfield.nextfield;
-      list->field.type = hpread_type_lookup (fieldp->dfield.type, objfile);
+      FIELD_TYPE (list->field) = hpread_type_lookup (fieldp->dfield.type,
+                                                    objfile);
     }
 
   TYPE_NFIELDS (type) = nfields;
@@ -1510,7 +1521,7 @@ hpread_read_struct_type (hp_type, dn_bufp, objfile)
 
 static struct type *
 hpread_read_set_type (hp_type, dn_bufp, objfile)
-     DNTTPOINTER hp_type;
+     dnttpointer hp_type;
      union dnttentry *dn_bufp;
      struct objfile *objfile;
 {
@@ -1534,7 +1545,7 @@ hpread_read_set_type (hp_type, dn_bufp, objfile)
 
 static struct type *
 hpread_read_array_type (hp_type, dn_bufp, objfile)
-     DNTTPOINTER hp_type;
+     dnttpointer hp_type;
      union dnttentry *dn_bufp;
      struct objfile *objfile;
 {
@@ -1576,7 +1587,7 @@ hpread_read_array_type (hp_type, dn_bufp, objfile)
 /* Read in and internalize a subrange debug symbol.  */
 static struct type *
 hpread_read_subrange_type (hp_type, dn_bufp, objfile)
-     DNTTPOINTER hp_type;
+     dnttpointer hp_type;
      union dnttentry *dn_bufp;
      struct objfile *objfile;
 {
@@ -1591,8 +1602,9 @@ hpread_read_subrange_type (hp_type, dn_bufp, objfile)
   TYPE_CODE (type) = TYPE_CODE_RANGE;
   TYPE_LENGTH (type) = dn_bufp->dsubr.bitlength / 8;
   TYPE_NFIELDS (type) = 2;
-  TYPE_FIELDS (type) = (struct field *) obstack_alloc
-    (&objfile->type_obstack, 2 * sizeof (struct field));
+  TYPE_FIELDS (type)
+    = (struct field *) obstack_alloc (&objfile->type_obstack,
+                                     2 * sizeof (struct field));
 
   if (dn_bufp->dsubr.dyn_low)
     TYPE_FIELD_BITPOS (type, 0) = 0;
@@ -1610,7 +1622,7 @@ hpread_read_subrange_type (hp_type, dn_bufp, objfile)
 
 static struct type *
 hpread_type_lookup (hp_type, objfile)
-     DNTTPOINTER hp_type;
+     dnttpointer hp_type;
      struct objfile *objfile;
 {
   union dnttentry *dn_bufp;
@@ -1627,24 +1639,24 @@ hpread_type_lookup (hp_type, objfile)
 
   switch (dn_bufp->dblock.kind)
     {
-    case K_SRCFILE:
-    case K_MODULE:
-    case K_FUNCTION:
-    case K_ENTRY:
-    case K_BEGIN:
-    case K_END:
-    case K_IMPORT:
-    case K_LABEL:
-    case K_WITH:
-    case K_COMMON:
-    case K_FPARAM:
-    case K_SVAR:
-    case K_DVAR:
-    case K_CONST:
+    case DNTT_TYPE_SRCFILE:
+    case DNTT_TYPE_MODULE:
+    case DNTT_TYPE_FUNCTION:
+    case DNTT_TYPE_ENTRY:
+    case DNTT_TYPE_BEGIN:
+    case DNTT_TYPE_END:
+    case DNTT_TYPE_IMPORT:
+    case DNTT_TYPE_LABEL:
+    case DNTT_TYPE_WITH:
+    case DNTT_TYPE_COMMON:
+    case DNTT_TYPE_FPARAM:
+    case DNTT_TYPE_SVAR:
+    case DNTT_TYPE_DVAR:
+    case DNTT_TYPE_CONST:
       /* Opps.  Something went very wrong.  */
       return lookup_fundamental_type (objfile, FT_VOID);
 
-    case K_TYPEDEF:
+    case DNTT_TYPE_TYPEDEF:
       {
        struct type *structtype = hpread_type_lookup (dn_bufp->dtype.type,
                                                      objfile);
@@ -1657,7 +1669,7 @@ hpread_type_lookup (hp_type, objfile)
        return structtype;
       }
 
-    case K_TAGDEF:
+    case DNTT_TYPE_TAGDEF:
       {
        /* Just a little different from above.  We have to tack on
           an identifier of some kind (struct, union, enum, etc).  */
@@ -1673,9 +1685,9 @@ hpread_type_lookup (hp_type, objfile)
        else
          abort ();
 
-       if (dn_bufp->dblock.kind == K_STRUCT)
+       if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT)
          prefix = "struct ";
-       else if (dn_bufp->dblock.kind == K_UNION)
+       else if (dn_bufp->dblock.kind == DNTT_TYPE_UNION)
          prefix = "union ";
        else
          prefix = "enum ";
@@ -1693,44 +1705,45 @@ hpread_type_lookup (hp_type, objfile)
 
        return structtype;
       }
-    case K_POINTER:
+    case DNTT_TYPE_POINTER:
       return lookup_pointer_type (hpread_type_lookup (dn_bufp->dptr.pointsto,
                                                      objfile));
-    case K_ENUM:
+    case DNTT_TYPE_ENUM:
       return hpread_read_enum_type (hp_type, dn_bufp, objfile);
-    case K_MEMENUM:
+    case DNTT_TYPE_MEMENUM:
       return lookup_fundamental_type (objfile, FT_VOID);
-    case K_SET:
+    case DNTT_TYPE_SET:
       return hpread_read_set_type (hp_type, dn_bufp, objfile);
-    case K_SUBRANGE:
+    case DNTT_TYPE_SUBRANGE:
       return hpread_read_subrange_type (hp_type, dn_bufp, objfile);
-    case K_ARRAY:
+    case DNTT_TYPE_ARRAY:
       return hpread_read_array_type (hp_type, dn_bufp, objfile);
-    case K_STRUCT:
-    case K_UNION:
+    case DNTT_TYPE_STRUCT:
+    case DNTT_TYPE_UNION:
       return hpread_read_struct_type (hp_type, dn_bufp, objfile);
-    case K_FIELD:
+    case DNTT_TYPE_FIELD:
       return hpread_type_lookup (dn_bufp->dfield.type, objfile);
-    case K_VARIANT:
-    case K_FILE:
+    case DNTT_TYPE_VARIANT:
+    case DNTT_TYPE_FILE:
       return lookup_fundamental_type (objfile, FT_VOID);
-    case K_FUNCTYPE:
+    case DNTT_TYPE_FUNCTYPE:
       return lookup_function_type (hpread_type_lookup (dn_bufp->dfunctype.retval,
                                                       objfile));
-    case K_COBSTRUCT:
-    case K_XREF:
-    case K_SA:
-    case K_MACRO:
+    case DNTT_TYPE_COBSTRUCT:
+    case DNTT_TYPE_XREF:
+    case DNTT_TYPE_SA:
+    case DNTT_TYPE_MACRO:
     default:
       return lookup_fundamental_type (objfile, FT_VOID);
     }
 }
 
-static SLTPOINTER
-hpread_record_lines (subfile, s_idx, e_idx, objfile)
+static sltpointer
+hpread_record_lines (subfile, s_idx, e_idx, objfile, offset)
      struct subfile *subfile;
-     SLTPOINTER s_idx, e_idx;
+     sltpointer s_idx, e_idx;
      struct objfile *objfile;
+     CORE_ADDR offset;
 {
   union sltentry *sl_bufp;
 
@@ -1740,7 +1753,8 @@ hpread_record_lines (subfile, s_idx, e_idx, objfile)
       /* Only record "normal" entries in the SLT.  */
       if (sl_bufp->snorm.sltdesc == SLT_NORMAL
          || sl_bufp->snorm.sltdesc == SLT_EXIT)
-       record_line (subfile, sl_bufp->snorm.line, sl_bufp->snorm.address);
+       record_line (subfile, sl_bufp->snorm.line,
+                    sl_bufp->snorm.address + offset);
       s_idx++;
     }
   return e_idx;
@@ -1765,7 +1779,7 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
   CORE_ADDR valu;
   int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
   union dnttentry *dn_temp;
-  DNTTPOINTER hp_type;
+  dnttpointer hp_type;
   struct symbol *sym;
   struct context_stack *new;
 
@@ -1773,7 +1787,7 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
   sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                         sizeof (struct symbol));
   memset (sym, 0, sizeof (struct symbol));
-  SYMBOL_NAME (sym) = name;
+  SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack);
   SYMBOL_LANGUAGE (sym) = language_auto;
   SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
   SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
@@ -1790,36 +1804,42 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
 
   switch (type)
     {
-    case K_SRCFILE:
+    case DNTT_TYPE_SRCFILE:
       /* This type of symbol indicates from which source file or include file
          the following data comes. If there are no modules it also may
          indicate the start of a new source file, in which case we must
          finish the symbol table of the previous source file
          (if any) and start accumulating a new symbol table.  */
 
-      valu = text_offset + offset;     /* Relocate for dynamic loading */
+      valu = text_offset;
       if (!last_source_file)
-       start_symtab (name, NULL, valu);
-
-      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
-                                               SL_INDEX (objfile),
-                                               dn_bufp->dsfile.address,
-                                               objfile);
+       {
+         start_symtab (name, NULL, valu);
+         record_debugformat ("HP");
+         SL_INDEX (objfile) = dn_bufp->dsfile.address;
+       }
+      else
+       {
+         SL_INDEX (objfile) = hpread_record_lines (current_subfile,
+                                                   SL_INDEX (objfile),
+                                                   dn_bufp->dsfile.address,
+                                                   objfile, offset);
+       }
       start_subfile (name, NULL);
       break;
       
-    case K_MODULE:
-      /* No need to do anything with these K_MODULE symbols anymore.  */
+    case DNTT_TYPE_MODULE:
+      /* No need to do anything with these DNTT_TYPE_MODULE symbols anymore.  */
       break;
 
-    case K_FUNCTION:
-    case K_ENTRY:
+    case DNTT_TYPE_FUNCTION:
+    case DNTT_TYPE_ENTRY:
       /* A function or secondary entry point.  */
       valu = dn_bufp->dfunc.lowaddr + offset;
       SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                dn_bufp->dfunc.address,
-                                               objfile);
+                                               objfile, offset);
       
       WITHIN_FUNCTION (objfile) = 1;
       CURRENT_FUNCTION_VALUE (objfile) = valu;
@@ -1831,14 +1851,14 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
 
       SYMBOL_CLASS (sym) = LOC_BLOCK;
       SYMBOL_TYPE (sym) = hpread_read_function_type (hp_type, dn_bufp, objfile);
-      if (dn_bufp->dfunc.public)
+      if (dn_bufp->dfunc.global)
        add_symbol_to_list (sym, &global_symbols);
       else
        add_symbol_to_list (sym, &file_symbols);
       new->name = sym;
 
       /* Search forward to the next scope beginning.  */
-      while (dn_bufp->dblock.kind != K_BEGIN)
+      while (dn_bufp->dblock.kind != DNTT_TYPE_BEGIN)
        {
          dn_bufp = hpread_get_lntt (++index, objfile);
          if (dn_bufp->dblock.extension)
@@ -1847,38 +1867,38 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
       SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                dn_bufp->dbegin.address,
-                                               objfile);
+                                               objfile, offset);
       SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dbegin.address, objfile);
       record_line (current_subfile, SYMBOL_LINE (sym), valu);
       break;
 
-    case K_BEGIN:
+    case DNTT_TYPE_BEGIN:
       /* Begin a new scope.  */
       SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                dn_bufp->dbegin.address,
-                                               objfile);
+                                               objfile, offset);
       valu = hpread_get_location (dn_bufp->dbegin.address, objfile);
       valu += offset;          /* Relocate for dynamic loading */
       desc = hpread_get_depth (dn_bufp->dbegin.address, objfile);
       new = push_context (desc, valu);
       break;
 
-    case K_END:
+    case DNTT_TYPE_END:
       /* End a scope.  */
       SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                dn_bufp->dend.address + 1,
-                                               objfile);
+                                               objfile, offset);
       switch (dn_bufp->dend.endkind)
        {
-       case K_MODULE:
+       case DNTT_TYPE_MODULE:
          /* Ending a module ends the symbol table for that module.  */
          valu = text_offset + text_size + offset;
-         (void) end_symtab (valu, 0, 0, objfile, 0);
+         (void) end_symtab (valu, objfile, 0);
          break;
 
-       case K_FUNCTION:
+       case DNTT_TYPE_FUNCTION:
          /* Ending a function, well, ends the function's scope.  */
          dn_temp = hpread_get_lntt (dn_bufp->dend.beginscope.dnttp.index,
                                     objfile);
@@ -1889,7 +1909,7 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
                        new->start_addr, valu, objfile);
          WITHIN_FUNCTION (objfile) = 0;
          break;
-       case K_BEGIN:
+       case DNTT_TYPE_BEGIN:
          /* Just ending a local scope.  */
          valu = hpread_get_location (dn_bufp->dend.address, objfile);
          /* Why in the hell is this needed?  */
@@ -1905,10 +1925,10 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
          break;
        }
       break;
-    case K_LABEL:
+    case DNTT_TYPE_LABEL:
       SYMBOL_NAMESPACE (sym) = LABEL_NAMESPACE;
       break;
-    case K_FPARAM:
+    case DNTT_TYPE_FPARAM:
       /* Function parameters.  */
       if (dn_bufp->dfparam.regparam)
        SYMBOL_CLASS (sym) = LOC_REGISTER;
@@ -1927,19 +1947,19 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
       SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dfparam.type, objfile);
       add_symbol_to_list (sym, &local_symbols);
       break;
-    case K_SVAR:
+    case DNTT_TYPE_SVAR:
       /* Static variables.  */
       SYMBOL_CLASS (sym) = LOC_STATIC;
       SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dsvar.location;
       SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dsvar.type, objfile);
-      if (dn_bufp->dsvar.public)
+      if (dn_bufp->dsvar.global)
        add_symbol_to_list (sym, &global_symbols);
       else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
       else
        add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_DVAR:
+    case DNTT_TYPE_DVAR:
       /* Dynamic variables.  */
       if (dn_bufp->ddvar.regvar)
        SYMBOL_CLASS (sym) = LOC_REGISTER;
@@ -1951,75 +1971,75 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
        += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
 #endif
       SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->ddvar.type, objfile);
-      if (dn_bufp->ddvar.public)
+      if (dn_bufp->ddvar.global)
        add_symbol_to_list (sym, &global_symbols);
       else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
       else
        add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_CONST:
+    case DNTT_TYPE_CONST:
       /* A constant (pascal?).  */
       SYMBOL_CLASS (sym) = LOC_CONST;
       SYMBOL_VALUE (sym) = dn_bufp->dconst.location;
       SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dconst.type, objfile);
-      if (dn_bufp->dconst.public)
+      if (dn_bufp->dconst.global)
        add_symbol_to_list (sym, &global_symbols);
       else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
       else
        add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_TYPEDEF:
+    case DNTT_TYPE_TYPEDEF:
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
-      if (dn_bufp->dtype.public)
+      if (dn_bufp->dtype.global)
        add_symbol_to_list (sym, &global_symbols);
       else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
       else
        add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_TAGDEF:
+    case DNTT_TYPE_TAGDEF:
       SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
       SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
       TYPE_NAME (sym->type) = SYMBOL_NAME (sym);
       TYPE_TAG_NAME (sym->type) = SYMBOL_NAME (sym);
-      if (dn_bufp->dtype.public)
+      if (dn_bufp->dtype.global)
        add_symbol_to_list (sym, &global_symbols);
       else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
       else
        add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_POINTER:
+    case DNTT_TYPE_POINTER:
       SYMBOL_TYPE (sym) = lookup_pointer_type (hpread_type_lookup
                                               (dn_bufp->dptr.pointsto,
                                                objfile));
       add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_ENUM:
+    case DNTT_TYPE_ENUM:
       SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
       SYMBOL_TYPE (sym) = hpread_read_enum_type (hp_type, dn_bufp, objfile);
       add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_MEMENUM:
+    case DNTT_TYPE_MEMENUM:
       break;
-    case K_SET:
+    case DNTT_TYPE_SET:
       SYMBOL_TYPE (sym) = hpread_read_set_type (hp_type, dn_bufp, objfile);
       add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_SUBRANGE:
+    case DNTT_TYPE_SUBRANGE:
       SYMBOL_TYPE (sym) = hpread_read_subrange_type (hp_type, dn_bufp,
                                                     objfile);
       add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_ARRAY:
+    case DNTT_TYPE_ARRAY:
       SYMBOL_TYPE (sym) = hpread_read_array_type (hp_type, dn_bufp, objfile);
       add_symbol_to_list (sym, &file_symbols);
       break;
-    case K_STRUCT:
-    case K_UNION:
+    case DNTT_TYPE_STRUCT:
+    case DNTT_TYPE_UNION:
       SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
       SYMBOL_TYPE (sym) = hpread_read_struct_type (hp_type, dn_bufp, objfile);
       add_symbol_to_list (sym, &file_symbols);
This page took 0.048714 seconds and 4 git commands to generate.