OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [hpread.c] - Diff between revs 105 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 105 Rev 1765
/* Read hp debug symbols and convert to internal format, for GDB.
/* Read hp debug symbols and convert to internal format, for GDB.
   Copyright 1993, 1996 Free Software Foundation, Inc.
   Copyright 1993, 1996 Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
   Boston, MA 02111-1307, USA.
 
 
   Written by the Center for Software Science at the University of Utah
   Written by the Center for Software Science at the University of Utah
   and by Cygnus Support.  */
   and by Cygnus Support.  */
 
 
#include "defs.h"
#include "defs.h"
#include "bfd.h"
#include "bfd.h"
#include "gdb_string.h"
#include "gdb_string.h"
#include "hp-symtab.h"
#include "hp-symtab.h"
#include "syms.h"
#include "syms.h"
#include "symtab.h"
#include "symtab.h"
#include "symfile.h"
#include "symfile.h"
#include "objfiles.h"
#include "objfiles.h"
#include "buildsym.h"
#include "buildsym.h"
#include "complaints.h"
#include "complaints.h"
#include "gdb-stabs.h"
#include "gdb-stabs.h"
#include "gdbtypes.h"
#include "gdbtypes.h"
#include "demangle.h"
#include "demangle.h"
 
 
/* Private information attached to an objfile which we use to find
/* Private information attached to an objfile which we use to find
   and internalize the HP C debug symbols within that objfile.  */
   and internalize the HP C debug symbols within that objfile.  */
 
 
struct hpread_symfile_info
struct hpread_symfile_info
  {
  {
    /* The contents of each of the debug sections (there are 4 of them).  */
    /* The contents of each of the debug sections (there are 4 of them).  */
    char *gntt;
    char *gntt;
    char *lntt;
    char *lntt;
    char *slt;
    char *slt;
    char *vt;
    char *vt;
 
 
    /* We keep the size of the $VT$ section for range checking.  */
    /* We keep the size of the $VT$ section for range checking.  */
    unsigned int vt_size;
    unsigned int vt_size;
 
 
    /* Some routines still need to know the number of symbols in the
    /* Some routines still need to know the number of symbols in the
       main debug sections ($LNTT$ and $GNTT$). */
       main debug sections ($LNTT$ and $GNTT$). */
    unsigned int lntt_symcount;
    unsigned int lntt_symcount;
    unsigned int gntt_symcount;
    unsigned int gntt_symcount;
 
 
    /* To keep track of all the types we've processed.  */
    /* To keep track of all the types we've processed.  */
    struct type **type_vector;
    struct type **type_vector;
    int type_vector_length;
    int type_vector_length;
 
 
    /* Keeps track of the beginning of a range of source lines.  */
    /* Keeps track of the beginning of a range of source lines.  */
    sltpointer sl_index;
    sltpointer sl_index;
 
 
    /* Some state variables we'll need.  */
    /* Some state variables we'll need.  */
    int within_function;
    int within_function;
 
 
    /* Keep track of the current function's address.  We may need to look
    /* Keep track of the current function's address.  We may need to look
       up something based on this address.  */
       up something based on this address.  */
    unsigned int current_function_value;
    unsigned int current_function_value;
  };
  };
 
 
/* Accessor macros to get at the fields.  */
/* Accessor macros to get at the fields.  */
#define HPUX_SYMFILE_INFO(o) \
#define HPUX_SYMFILE_INFO(o) \
  ((struct hpread_symfile_info *)((o)->sym_private))
  ((struct hpread_symfile_info *)((o)->sym_private))
#define GNTT(o)                 (HPUX_SYMFILE_INFO(o)->gntt)
#define GNTT(o)                 (HPUX_SYMFILE_INFO(o)->gntt)
#define LNTT(o)                 (HPUX_SYMFILE_INFO(o)->lntt)
#define LNTT(o)                 (HPUX_SYMFILE_INFO(o)->lntt)
#define SLT(o)                  (HPUX_SYMFILE_INFO(o)->slt)
#define SLT(o)                  (HPUX_SYMFILE_INFO(o)->slt)
#define VT(o)                   (HPUX_SYMFILE_INFO(o)->vt)
#define VT(o)                   (HPUX_SYMFILE_INFO(o)->vt)
#define VT_SIZE(o)              (HPUX_SYMFILE_INFO(o)->vt_size)
#define VT_SIZE(o)              (HPUX_SYMFILE_INFO(o)->vt_size)
#define LNTT_SYMCOUNT(o)        (HPUX_SYMFILE_INFO(o)->lntt_symcount)
#define LNTT_SYMCOUNT(o)        (HPUX_SYMFILE_INFO(o)->lntt_symcount)
#define GNTT_SYMCOUNT(o)        (HPUX_SYMFILE_INFO(o)->gntt_symcount)
#define GNTT_SYMCOUNT(o)        (HPUX_SYMFILE_INFO(o)->gntt_symcount)
#define TYPE_VECTOR(o)          (HPUX_SYMFILE_INFO(o)->type_vector)
#define TYPE_VECTOR(o)          (HPUX_SYMFILE_INFO(o)->type_vector)
#define TYPE_VECTOR_LENGTH(o)   (HPUX_SYMFILE_INFO(o)->type_vector_length)
#define TYPE_VECTOR_LENGTH(o)   (HPUX_SYMFILE_INFO(o)->type_vector_length)
#define SL_INDEX(o)             (HPUX_SYMFILE_INFO(o)->sl_index)
#define SL_INDEX(o)             (HPUX_SYMFILE_INFO(o)->sl_index)
#define WITHIN_FUNCTION(o)      (HPUX_SYMFILE_INFO(o)->within_function)
#define WITHIN_FUNCTION(o)      (HPUX_SYMFILE_INFO(o)->within_function)
#define CURRENT_FUNCTION_VALUE(o) (HPUX_SYMFILE_INFO(o)->current_function_value)
#define CURRENT_FUNCTION_VALUE(o) (HPUX_SYMFILE_INFO(o)->current_function_value)
 
 
/* Given the native debug symbol SYM, set NAMEP to the name associated
/* Given the native debug symbol SYM, set NAMEP to the name associated
   with the debug symbol.  Note we may be called with a debug symbol which
   with the debug symbol.  Note we may be called with a debug symbol which
   has no associated name, in that case we return an empty string.
   has no associated name, in that case we return an empty string.
 
 
   Also note we "know" that the name for any symbol is always in the
   Also note we "know" that the name for any symbol is always in the
   same place.  Hence we don't have to conditionalize on the symbol type.  */
   same place.  Hence we don't have to conditionalize on the symbol type.  */
#define SET_NAMESTRING(SYM, NAMEP, OBJFILE) \
#define SET_NAMESTRING(SYM, NAMEP, OBJFILE) \
  if (! hpread_has_name ((SYM)->dblock.kind)) \
  if (! hpread_has_name ((SYM)->dblock.kind)) \
    *NAMEP = ""; \
    *NAMEP = ""; \
  else if (((unsigned)(SYM)->dsfile.name) >= VT_SIZE (OBJFILE)) \
  else if (((unsigned)(SYM)->dsfile.name) >= VT_SIZE (OBJFILE)) \
    { \
    { \
      complain (&string_table_offset_complaint, (char *) symnum); \
      complain (&string_table_offset_complaint, (char *) symnum); \
      *NAMEP = ""; \
      *NAMEP = ""; \
    } \
    } \
  else \
  else \
    *NAMEP = (SYM)->dsfile.name + VT (OBJFILE)
    *NAMEP = (SYM)->dsfile.name + VT (OBJFILE)


/* We put a pointer to this structure in the read_symtab_private field
/* We put a pointer to this structure in the read_symtab_private field
   of the psymtab.  */
   of the psymtab.  */
 
 
struct symloc
struct symloc
  {
  {
    /* The offset within the file symbol table of first local symbol for
    /* The offset within the file symbol table of first local symbol for
       this file.  */
       this file.  */
 
 
    int ldsymoff;
    int ldsymoff;
 
 
    /* Length (in bytes) of the section of the symbol table devoted to
    /* Length (in bytes) of the section of the symbol table devoted to
       this file's symbols (actually, the section bracketed may contain
       this file's symbols (actually, the section bracketed may contain
       more than just this file's symbols).  If ldsymlen is 0, the only
       more than just this file's symbols).  If ldsymlen is 0, the only
       reason for this thing's existence is the dependency list.
       reason for this thing's existence is the dependency list.
       Nothing else will happen when it is read in.  */
       Nothing else will happen when it is read in.  */
 
 
    int ldsymlen;
    int ldsymlen;
  };
  };
 
 
#define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
#define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
#define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
#define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
#define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))
#define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))


/* FIXME: Shouldn't this stuff be in a .h file somewhere?  */
/* FIXME: Shouldn't this stuff be in a .h file somewhere?  */
/* Nonzero means give verbose info on gdb action.  */
/* Nonzero means give verbose info on gdb action.  */
extern int info_verbose;
extern int info_verbose;
 
 
/* Complaints about the symbols we have encountered.  */
/* Complaints about the symbols we have encountered.  */
extern struct complaint string_table_offset_complaint;
extern struct complaint string_table_offset_complaint;
extern struct complaint lbrac_unmatched_complaint;
extern struct complaint lbrac_unmatched_complaint;
extern struct complaint lbrac_mismatch_complaint;
extern struct complaint lbrac_mismatch_complaint;


 
 
void hpread_symfile_init PARAMS ((struct objfile *));
void hpread_symfile_init PARAMS ((struct objfile *));
 
 
static struct type *
static struct type *
  hpread_read_array_type PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
  hpread_read_array_type PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
 
 
static struct type *hpread_alloc_type
static struct type *hpread_alloc_type
  PARAMS ((dnttpointer, struct objfile *));
  PARAMS ((dnttpointer, struct objfile *));
 
 
static struct type **hpread_lookup_type
static struct type **hpread_lookup_type
  PARAMS ((dnttpointer, struct objfile *));
  PARAMS ((dnttpointer, struct objfile *));
 
 
static struct type *hpread_read_enum_type
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
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
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
static struct type *hpread_read_struct_type
  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
  PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
 
 
void hpread_build_psymtabs
void hpread_build_psymtabs
  PARAMS ((struct objfile *, int));
  PARAMS ((struct objfile *, int));
 
 
void hpread_symfile_finish PARAMS ((struct objfile *));
void hpread_symfile_finish PARAMS ((struct objfile *));
 
 
static struct partial_symtab *hpread_start_psymtab
static struct partial_symtab *hpread_start_psymtab
  PARAMS ((struct objfile *, char *, CORE_ADDR, int,
  PARAMS ((struct objfile *, char *, CORE_ADDR, int,
           struct partial_symbol **, struct partial_symbol **));
           struct partial_symbol **, struct partial_symbol **));
 
 
static struct partial_symtab *hpread_end_psymtab
static struct partial_symtab *hpread_end_psymtab
  PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
  PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
           struct partial_symtab **, int));
           struct partial_symtab **, int));
 
 
static struct symtab *hpread_expand_symtab
static struct symtab *hpread_expand_symtab
  PARAMS ((struct objfile *, int, int, CORE_ADDR, int,
  PARAMS ((struct objfile *, int, int, CORE_ADDR, int,
           struct section_offsets *, char *));
           struct section_offsets *, char *));
 
 
static void hpread_process_one_debug_symbol
static void hpread_process_one_debug_symbol
  PARAMS ((union dnttentry *, char *, struct section_offsets *,
  PARAMS ((union dnttentry *, char *, struct section_offsets *,
           struct objfile *, CORE_ADDR, int, char *, int));
           struct objfile *, CORE_ADDR, int, char *, int));
 
 
static sltpointer hpread_record_lines
static sltpointer hpread_record_lines
  PARAMS ((struct subfile *, sltpointer, sltpointer,
  PARAMS ((struct subfile *, sltpointer, sltpointer,
           struct objfile *, CORE_ADDR));
           struct objfile *, CORE_ADDR));
 
 
static struct type *hpread_read_function_type
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
static struct type *hpread_type_lookup
  PARAMS ((dnttpointer, struct objfile *));
  PARAMS ((dnttpointer, struct objfile *));
 
 
static unsigned long hpread_get_depth
static unsigned long hpread_get_depth
  PARAMS ((sltpointer, struct objfile *));
  PARAMS ((sltpointer, struct objfile *));
 
 
static unsigned long hpread_get_line
static unsigned long hpread_get_line
  PARAMS ((sltpointer, struct objfile *));
  PARAMS ((sltpointer, struct objfile *));
 
 
static CORE_ADDR hpread_get_location
static CORE_ADDR hpread_get_location
  PARAMS ((sltpointer, struct objfile *));
  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 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_gntt PARAMS ((int, struct objfile *));
static union dnttentry *hpread_get_lntt 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 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 PARAMS ((struct partial_symtab *));
static void hpread_psymtab_to_symtab_1 PARAMS ((struct partial_symtab *));
static void hpread_psymtab_to_symtab_1 PARAMS ((struct partial_symtab *));
static int hpread_has_name PARAMS ((enum dntt_entry_type));
static int hpread_has_name PARAMS ((enum dntt_entry_type));


 
 
/* Initialization for reading native HP C debug symbols from OBJFILE.
/* Initialization for reading native HP C debug symbols from OBJFILE.
 
 
   It's only purpose in life is to set up the symbol reader's private
   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
   per-objfile data structures, and read in the raw contents of the debug
   sections (attaching pointers to the debug info into the private data
   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
   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
   way (and may never do so...), we have to do it ourselves.  Note we may
   be called on a file without native HP C debugging symbols.
   be called on a file without native HP C debugging symbols.
   FIXME, there should be a cleaner peephole into the BFD environment here.  */
   FIXME, there should be a cleaner peephole into the BFD environment here.  */
 
 
void
void
hpread_symfile_init (objfile)
hpread_symfile_init (objfile)
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  asection *vt_section, *slt_section, *lntt_section, *gntt_section;
  asection *vt_section, *slt_section, *lntt_section, *gntt_section;
 
 
  /* Allocate struct to keep track of the symfile */
  /* Allocate struct to keep track of the symfile */
  objfile->sym_private = (PTR)
  objfile->sym_private = (PTR)
    xmmalloc (objfile->md, sizeof (struct hpread_symfile_info));
    xmmalloc (objfile->md, sizeof (struct hpread_symfile_info));
  memset (objfile->sym_private, 0, sizeof (struct hpread_symfile_info));
  memset (objfile->sym_private, 0, sizeof (struct hpread_symfile_info));
 
 
  /* We haven't read in any types yet.  */
  /* We haven't read in any types yet.  */
  TYPE_VECTOR (objfile) = 0;
  TYPE_VECTOR (objfile) = 0;
 
 
  /* Read in data from the $GNTT$ subspace.  */
  /* Read in data from the $GNTT$ subspace.  */
  gntt_section = bfd_get_section_by_name (objfile->obfd, "$GNTT$");
  gntt_section = bfd_get_section_by_name (objfile->obfd, "$GNTT$");
  if (!gntt_section)
  if (!gntt_section)
    return;
    return;
 
 
  GNTT (objfile)
  GNTT (objfile)
    = obstack_alloc (&objfile->symbol_obstack,
    = obstack_alloc (&objfile->symbol_obstack,
                     bfd_section_size (objfile->obfd, gntt_section));
                     bfd_section_size (objfile->obfd, gntt_section));
 
 
  bfd_get_section_contents (objfile->obfd, gntt_section, GNTT (objfile),
  bfd_get_section_contents (objfile->obfd, gntt_section, GNTT (objfile),
                         0, bfd_section_size (objfile->obfd, gntt_section));
                         0, bfd_section_size (objfile->obfd, gntt_section));
 
 
  GNTT_SYMCOUNT (objfile)
  GNTT_SYMCOUNT (objfile)
    = bfd_section_size (objfile->obfd, gntt_section)
    = bfd_section_size (objfile->obfd, gntt_section)
    / sizeof (struct dntt_type_block);
    / sizeof (struct dntt_type_block);
 
 
  /* Read in data from the $LNTT$ subspace.   Also keep track of the number
  /* Read in data from the $LNTT$ subspace.   Also keep track of the number
     of LNTT symbols.  */
     of LNTT symbols.  */
  lntt_section = bfd_get_section_by_name (objfile->obfd, "$LNTT$");
  lntt_section = bfd_get_section_by_name (objfile->obfd, "$LNTT$");
  if (!lntt_section)
  if (!lntt_section)
    return;
    return;
 
 
  LNTT (objfile)
  LNTT (objfile)
    = obstack_alloc (&objfile->symbol_obstack,
    = obstack_alloc (&objfile->symbol_obstack,
                     bfd_section_size (objfile->obfd, lntt_section));
                     bfd_section_size (objfile->obfd, lntt_section));
 
 
  bfd_get_section_contents (objfile->obfd, lntt_section, LNTT (objfile),
  bfd_get_section_contents (objfile->obfd, lntt_section, LNTT (objfile),
                         0, bfd_section_size (objfile->obfd, lntt_section));
                         0, bfd_section_size (objfile->obfd, lntt_section));
 
 
  LNTT_SYMCOUNT (objfile)
  LNTT_SYMCOUNT (objfile)
    = bfd_section_size (objfile->obfd, lntt_section)
    = bfd_section_size (objfile->obfd, lntt_section)
    / sizeof (struct dntt_type_block);
    / sizeof (struct dntt_type_block);
 
 
  /* Read in data from the $SLT$ subspace.  $SLT$ contains information
  /* Read in data from the $SLT$ subspace.  $SLT$ contains information
     on source line numbers.  */
     on source line numbers.  */
  slt_section = bfd_get_section_by_name (objfile->obfd, "$SLT$");
  slt_section = bfd_get_section_by_name (objfile->obfd, "$SLT$");
  if (!slt_section)
  if (!slt_section)
    return;
    return;
 
 
  SLT (objfile) =
  SLT (objfile) =
    obstack_alloc (&objfile->symbol_obstack,
    obstack_alloc (&objfile->symbol_obstack,
                   bfd_section_size (objfile->obfd, slt_section));
                   bfd_section_size (objfile->obfd, slt_section));
 
 
  bfd_get_section_contents (objfile->obfd, slt_section, SLT (objfile),
  bfd_get_section_contents (objfile->obfd, slt_section, SLT (objfile),
                          0, bfd_section_size (objfile->obfd, slt_section));
                          0, bfd_section_size (objfile->obfd, slt_section));
 
 
  /* Read in data from the $VT$ subspace.  $VT$ contains things like
  /* Read in data from the $VT$ subspace.  $VT$ contains things like
     names and constants.  Keep track of the number of symbols in the VT.  */
     names and constants.  Keep track of the number of symbols in the VT.  */
  vt_section = bfd_get_section_by_name (objfile->obfd, "$VT$");
  vt_section = bfd_get_section_by_name (objfile->obfd, "$VT$");
  if (!vt_section)
  if (!vt_section)
    return;
    return;
 
 
  VT_SIZE (objfile) = bfd_section_size (objfile->obfd, vt_section);
  VT_SIZE (objfile) = bfd_section_size (objfile->obfd, vt_section);
 
 
  VT (objfile) =
  VT (objfile) =
    (char *) obstack_alloc (&objfile->symbol_obstack,
    (char *) obstack_alloc (&objfile->symbol_obstack,
                            VT_SIZE (objfile));
                            VT_SIZE (objfile));
 
 
  bfd_get_section_contents (objfile->obfd, vt_section, VT (objfile),
  bfd_get_section_contents (objfile->obfd, vt_section, VT (objfile),
                            0, VT_SIZE (objfile));
                            0, VT_SIZE (objfile));
}
}
 
 
/* Scan and build partial symbols for a symbol file.
/* Scan and build partial symbols for a symbol file.
 
 
   The minimal symbol table (either SOM or HP a.out) has already been
   The minimal symbol table (either SOM or HP a.out) has already been
   read in; all we need to do is setup partial symbols based on the
   read in; all we need to do is setup partial symbols based on the
   native debugging information.
   native debugging information.
 
 
   We assume hpread_symfile_init has been called to initialize the
   We assume hpread_symfile_init has been called to initialize the
   symbol reader's private data structures.
   symbol reader's private data structures.
 
 
   MAINLINE is true if we are reading the main symbol
   MAINLINE is true if we are reading the main symbol
   table (as opposed to a shared lib or dynamically loaded file).  */
   table (as opposed to a shared lib or dynamically loaded file).  */
 
 
void
void
hpread_build_psymtabs (objfile, mainline)
hpread_build_psymtabs (objfile, mainline)
     struct objfile *objfile;
     struct objfile *objfile;
     int mainline;
     int mainline;
{
{
  char *namestring;
  char *namestring;
  int past_first_source_file = 0;
  int past_first_source_file = 0;
  struct cleanup *old_chain;
  struct cleanup *old_chain;
 
 
  int hp_symnum, symcount, i;
  int hp_symnum, symcount, i;
 
 
  union dnttentry *dn_bufp;
  union dnttentry *dn_bufp;
  unsigned long valu;
  unsigned long valu;
  char *p;
  char *p;
  int texthigh = 0;
  int texthigh = 0;
  int have_name = 0;
  int have_name = 0;
 
 
  /* Current partial symtab */
  /* Current partial symtab */
  struct partial_symtab *pst;
  struct partial_symtab *pst;
 
 
  /* List of current psymtab's include files */
  /* List of current psymtab's include files */
  char **psymtab_include_list;
  char **psymtab_include_list;
  int includes_allocated;
  int includes_allocated;
  int includes_used;
  int includes_used;
 
 
  /* Index within current psymtab dependency list */
  /* Index within current psymtab dependency list */
  struct partial_symtab **dependency_list;
  struct partial_symtab **dependency_list;
  int dependencies_used, dependencies_allocated;
  int dependencies_used, dependencies_allocated;
 
 
  /* Just in case the stabs reader left turds lying around.  */
  /* Just in case the stabs reader left turds lying around.  */
  free_pending_blocks ();
  free_pending_blocks ();
  make_cleanup (really_free_pendings, 0);
  make_cleanup (really_free_pendings, 0);
 
 
  pst = (struct partial_symtab *) 0;
  pst = (struct partial_symtab *) 0;
 
 
  /* We shouldn't use alloca, instead use malloc/free.  Doing so avoids
  /* We shouldn't use alloca, instead use malloc/free.  Doing so avoids
     a number of problems with cross compilation and creating useless holes
     a number of problems with cross compilation and creating useless holes
     in the stack when we have to allocate new entries.  FIXME.  */
     in the stack when we have to allocate new entries.  FIXME.  */
 
 
  includes_allocated = 30;
  includes_allocated = 30;
  includes_used = 0;
  includes_used = 0;
  psymtab_include_list = (char **) alloca (includes_allocated *
  psymtab_include_list = (char **) alloca (includes_allocated *
                                           sizeof (char *));
                                           sizeof (char *));
 
 
  dependencies_allocated = 30;
  dependencies_allocated = 30;
  dependencies_used = 0;
  dependencies_used = 0;
  dependency_list =
  dependency_list =
    (struct partial_symtab **) alloca (dependencies_allocated *
    (struct partial_symtab **) alloca (dependencies_allocated *
                                       sizeof (struct partial_symtab *));
                                       sizeof (struct partial_symtab *));
 
 
  old_chain = make_cleanup (free_objfile, objfile);
  old_chain = make_cleanup (free_objfile, objfile);
 
 
  last_source_file = 0;
  last_source_file = 0;
 
 
  /* Make two passes, one ofr the GNTT symbols, the other for the
  /* Make two passes, one ofr the GNTT symbols, the other for the
     LNTT symbols.  */
     LNTT symbols.  */
  for (i = 0; i < 1; i++)
  for (i = 0; i < 1; i++)
    {
    {
      int within_function = 0;
      int within_function = 0;
 
 
      if (i)
      if (i)
        symcount = GNTT_SYMCOUNT (objfile);
        symcount = GNTT_SYMCOUNT (objfile);
      else
      else
        symcount = LNTT_SYMCOUNT (objfile);
        symcount = LNTT_SYMCOUNT (objfile);
 
 
      for (hp_symnum = 0; hp_symnum < symcount; hp_symnum++)
      for (hp_symnum = 0; hp_symnum < symcount; hp_symnum++)
        {
        {
          QUIT;
          QUIT;
          if (i)
          if (i)
            dn_bufp = hpread_get_gntt (hp_symnum, objfile);
            dn_bufp = hpread_get_gntt (hp_symnum, objfile);
          else
          else
            dn_bufp = hpread_get_lntt (hp_symnum, objfile);
            dn_bufp = hpread_get_lntt (hp_symnum, objfile);
 
 
          if (dn_bufp->dblock.extension)
          if (dn_bufp->dblock.extension)
            continue;
            continue;
 
 
          /* Only handle things which are necessary for minimal symbols.
          /* Only handle things which are necessary for minimal symbols.
             everything else is ignored.  */
             everything else is ignored.  */
          switch (dn_bufp->dblock.kind)
          switch (dn_bufp->dblock.kind)
            {
            {
            case DNTT_TYPE_SRCFILE:
            case DNTT_TYPE_SRCFILE:
              {
              {
                /* A source file of some kind.  Note this may simply
                /* A source file of some kind.  Note this may simply
                   be an included file.  */
                   be an included file.  */
                SET_NAMESTRING (dn_bufp, &namestring, objfile);
                SET_NAMESTRING (dn_bufp, &namestring, objfile);
 
 
                /* Check if this is the source file we are already working
                /* Check if this is the source file we are already working
                   with.  */
                   with.  */
                if (pst && !strcmp (namestring, pst->filename))
                if (pst && !strcmp (namestring, pst->filename))
                  continue;
                  continue;
 
 
                /* Check if this is an include file, if so check if we have
                /* Check if this is an include file, if so check if we have
                   already seen it.  Add it to the include list */
                   already seen it.  Add it to the include list */
                p = strrchr (namestring, '.');
                p = strrchr (namestring, '.');
                if (!strcmp (p, ".h"))
                if (!strcmp (p, ".h"))
                  {
                  {
                    int j, found;
                    int j, found;
 
 
                    found = 0;
                    found = 0;
                    for (j = 0; j < includes_used; j++)
                    for (j = 0; j < includes_used; j++)
                      if (!strcmp (namestring, psymtab_include_list[j]))
                      if (!strcmp (namestring, psymtab_include_list[j]))
                        {
                        {
                          found = 1;
                          found = 1;
                          break;
                          break;
                        }
                        }
                    if (found)
                    if (found)
                      continue;
                      continue;
 
 
                    /* Add it to the list of includes seen so far and
                    /* Add it to the list of includes seen so far and
                       allocate more include space if necessary.  */
                       allocate more include space if necessary.  */
                    psymtab_include_list[includes_used++] = namestring;
                    psymtab_include_list[includes_used++] = namestring;
                    if (includes_used >= includes_allocated)
                    if (includes_used >= includes_allocated)
                      {
                      {
                        char **orig = psymtab_include_list;
                        char **orig = psymtab_include_list;
 
 
                        psymtab_include_list = (char **)
                        psymtab_include_list = (char **)
                          alloca ((includes_allocated *= 2) *
                          alloca ((includes_allocated *= 2) *
                                  sizeof (char *));
                                  sizeof (char *));
                        memcpy ((PTR) psymtab_include_list, (PTR) orig,
                        memcpy ((PTR) psymtab_include_list, (PTR) orig,
                                includes_used * sizeof (char *));
                                includes_used * sizeof (char *));
                      }
                      }
                    continue;
                    continue;
                  }
                  }
 
 
 
 
                if (pst)
                if (pst)
                  {
                  {
                    if (!have_name)
                    if (!have_name)
                      {
                      {
                        pst->filename = (char *)
                        pst->filename = (char *)
                          obstack_alloc (&pst->objfile->psymbol_obstack,
                          obstack_alloc (&pst->objfile->psymbol_obstack,
                                         strlen (namestring) + 1);
                                         strlen (namestring) + 1);
                        strcpy (pst->filename, namestring);
                        strcpy (pst->filename, namestring);
                        have_name = 1;
                        have_name = 1;
                        continue;
                        continue;
                      }
                      }
                    continue;
                    continue;
                  }
                  }
 
 
                /* This is a bonafide new source file.
                /* This is a bonafide new source file.
                   End the current partial symtab and start a new one.  */
                   End the current partial symtab and start a new one.  */
 
 
                if (pst && past_first_source_file)
                if (pst && past_first_source_file)
                  {
                  {
                    hpread_end_psymtab (pst, psymtab_include_list,
                    hpread_end_psymtab (pst, psymtab_include_list,
                                        includes_used,
                                        includes_used,
                                        (hp_symnum
                                        (hp_symnum
                                         * sizeof (struct dntt_type_block)),
                                         * sizeof (struct dntt_type_block)),
                                        texthigh,
                                        texthigh,
                                        dependency_list, dependencies_used);
                                        dependency_list, dependencies_used);
                    pst = (struct partial_symtab *) 0;
                    pst = (struct partial_symtab *) 0;
                    includes_used = 0;
                    includes_used = 0;
                    dependencies_used = 0;
                    dependencies_used = 0;
                  }
                  }
                else
                else
                  past_first_source_file = 1;
                  past_first_source_file = 1;
 
 
                valu = hpread_get_textlow (i, hp_symnum, objfile);
                valu = hpread_get_textlow (i, hp_symnum, objfile);
                valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
                valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
                pst = hpread_start_psymtab (objfile,
                pst = hpread_start_psymtab (objfile,
                                            namestring, valu,
                                            namestring, valu,
                                            (hp_symnum
                                            (hp_symnum
                                         * sizeof (struct dntt_type_block)),
                                         * sizeof (struct dntt_type_block)),
                                            objfile->global_psymbols.next,
                                            objfile->global_psymbols.next,
                                            objfile->static_psymbols.next);
                                            objfile->static_psymbols.next);
                texthigh = valu;
                texthigh = valu;
                have_name = 1;
                have_name = 1;
                continue;
                continue;
              }
              }
 
 
            case DNTT_TYPE_MODULE:
            case DNTT_TYPE_MODULE:
              /* A source file.  It's still unclear to me what the
              /* A source file.  It's still unclear to me what the
                 real difference between a DNTT_TYPE_SRCFILE and DNTT_TYPE_MODULE
                 real difference between a DNTT_TYPE_SRCFILE and DNTT_TYPE_MODULE
                 is supposed to be.  */
                 is supposed to be.  */
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              valu = hpread_get_textlow (i, hp_symnum, objfile);
              valu = hpread_get_textlow (i, hp_symnum, objfile);
              valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
              valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
              if (!pst)
              if (!pst)
                {
                {
                  pst = hpread_start_psymtab (objfile,
                  pst = hpread_start_psymtab (objfile,
                                              namestring, valu,
                                              namestring, valu,
                                              (hp_symnum
                                              (hp_symnum
                                         * sizeof (struct dntt_type_block)),
                                         * sizeof (struct dntt_type_block)),
                                              objfile->global_psymbols.next,
                                              objfile->global_psymbols.next,
                                              objfile->static_psymbols.next);
                                              objfile->static_psymbols.next);
                  texthigh = valu;
                  texthigh = valu;
                  have_name = 0;
                  have_name = 0;
                }
                }
              continue;
              continue;
            case DNTT_TYPE_FUNCTION:
            case DNTT_TYPE_FUNCTION:
            case DNTT_TYPE_ENTRY:
            case DNTT_TYPE_ENTRY:
              /* The beginning of a function.  DNTT_TYPE_ENTRY may also denote
              /* The beginning of a function.  DNTT_TYPE_ENTRY may also denote
                 a secondary entry point.  */
                 a secondary entry point.  */
              valu = dn_bufp->dfunc.hiaddr + ANOFFSET (objfile->section_offsets,
              valu = dn_bufp->dfunc.hiaddr + ANOFFSET (objfile->section_offsets,
                                                       SECT_OFF_TEXT);
                                                       SECT_OFF_TEXT);
              if (valu > texthigh)
              if (valu > texthigh)
                texthigh = valu;
                texthigh = valu;
              valu = dn_bufp->dfunc.lowaddr +
              valu = dn_bufp->dfunc.lowaddr +
                ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
                ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              add_psymbol_to_list (namestring, strlen (namestring),
              add_psymbol_to_list (namestring, strlen (namestring),
                                   VAR_NAMESPACE, LOC_BLOCK,
                                   VAR_NAMESPACE, LOC_BLOCK,
                                   &objfile->static_psymbols, valu,
                                   &objfile->static_psymbols, valu,
                                   0, language_unknown, objfile);
                                   0, language_unknown, objfile);
              within_function = 1;
              within_function = 1;
              continue;
              continue;
            case DNTT_TYPE_BEGIN:
            case DNTT_TYPE_BEGIN:
            case DNTT_TYPE_END:
            case DNTT_TYPE_END:
              /* Scope block begin/end.  We only care about function
              /* Scope block begin/end.  We only care about function
                 and file blocks right now.  */
                 and file blocks right now.  */
              if (dn_bufp->dend.endkind == DNTT_TYPE_MODULE)
              if (dn_bufp->dend.endkind == DNTT_TYPE_MODULE)
                {
                {
                  hpread_end_psymtab (pst, psymtab_include_list, includes_used,
                  hpread_end_psymtab (pst, psymtab_include_list, includes_used,
                                      (hp_symnum
                                      (hp_symnum
                                       * sizeof (struct dntt_type_block)),
                                       * sizeof (struct dntt_type_block)),
                                      texthigh,
                                      texthigh,
                                      dependency_list, dependencies_used);
                                      dependency_list, dependencies_used);
                  pst = (struct partial_symtab *) 0;
                  pst = (struct partial_symtab *) 0;
                  includes_used = 0;
                  includes_used = 0;
                  dependencies_used = 0;
                  dependencies_used = 0;
                  have_name = 0;
                  have_name = 0;
                }
                }
              if (dn_bufp->dend.endkind == DNTT_TYPE_FUNCTION)
              if (dn_bufp->dend.endkind == DNTT_TYPE_FUNCTION)
                within_function = 0;
                within_function = 0;
              continue;
              continue;
            case DNTT_TYPE_SVAR:
            case DNTT_TYPE_SVAR:
            case DNTT_TYPE_DVAR:
            case DNTT_TYPE_DVAR:
            case DNTT_TYPE_TYPEDEF:
            case DNTT_TYPE_TYPEDEF:
            case DNTT_TYPE_TAGDEF:
            case DNTT_TYPE_TAGDEF:
              {
              {
                /* Variables, typedefs an the like.  */
                /* Variables, typedefs an the like.  */
                enum address_class storage;
                enum address_class storage;
                namespace_enum namespace;
                namespace_enum namespace;
 
 
                /* Don't add locals to the partial symbol table.  */
                /* Don't add locals to the partial symbol table.  */
                if (within_function
                if (within_function
                    && (dn_bufp->dblock.kind == DNTT_TYPE_SVAR
                    && (dn_bufp->dblock.kind == DNTT_TYPE_SVAR
                        || dn_bufp->dblock.kind == DNTT_TYPE_DVAR))
                        || dn_bufp->dblock.kind == DNTT_TYPE_DVAR))
                  continue;
                  continue;
 
 
                /* TAGDEFs go into the structure namespace.  */
                /* TAGDEFs go into the structure namespace.  */
                if (dn_bufp->dblock.kind == DNTT_TYPE_TAGDEF)
                if (dn_bufp->dblock.kind == DNTT_TYPE_TAGDEF)
                  namespace = STRUCT_NAMESPACE;
                  namespace = STRUCT_NAMESPACE;
                else
                else
                  namespace = VAR_NAMESPACE;
                  namespace = VAR_NAMESPACE;
 
 
                /* What kind of "storage" does this use?  */
                /* What kind of "storage" does this use?  */
                if (dn_bufp->dblock.kind == DNTT_TYPE_SVAR)
                if (dn_bufp->dblock.kind == DNTT_TYPE_SVAR)
                  storage = LOC_STATIC;
                  storage = LOC_STATIC;
                else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR
                else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR
                         && dn_bufp->ddvar.regvar)
                         && dn_bufp->ddvar.regvar)
                  storage = LOC_REGISTER;
                  storage = LOC_REGISTER;
                else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR)
                else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR)
                  storage = LOC_LOCAL;
                  storage = LOC_LOCAL;
                else
                else
                  storage = LOC_UNDEF;
                  storage = LOC_UNDEF;
 
 
                SET_NAMESTRING (dn_bufp, &namestring, objfile);
                SET_NAMESTRING (dn_bufp, &namestring, objfile);
                if (!pst)
                if (!pst)
                  {
                  {
                    pst = hpread_start_psymtab (objfile,
                    pst = hpread_start_psymtab (objfile,
                                                "globals", 0,
                                                "globals", 0,
                                                (hp_symnum
                                                (hp_symnum
                                         * sizeof (struct dntt_type_block)),
                                         * sizeof (struct dntt_type_block)),
                                              objfile->global_psymbols.next,
                                              objfile->global_psymbols.next,
                                             objfile->static_psymbols.next);
                                             objfile->static_psymbols.next);
                  }
                  }
                if (dn_bufp->dsvar.global)
                if (dn_bufp->dsvar.global)
                  {
                  {
                    add_psymbol_to_list (namestring, strlen (namestring),
                    add_psymbol_to_list (namestring, strlen (namestring),
                                         namespace, storage,
                                         namespace, storage,
                                         &objfile->global_psymbols,
                                         &objfile->global_psymbols,
                                         dn_bufp->dsvar.location,
                                         dn_bufp->dsvar.location,
                                         0, language_unknown, objfile);
                                         0, language_unknown, objfile);
                  }
                  }
                else
                else
                  {
                  {
                    add_psymbol_to_list (namestring, strlen (namestring),
                    add_psymbol_to_list (namestring, strlen (namestring),
                                         namespace, storage,
                                         namespace, storage,
                                         &objfile->static_psymbols,
                                         &objfile->static_psymbols,
                                         dn_bufp->dsvar.location,
                                         dn_bufp->dsvar.location,
                                         0, language_unknown, objfile);
                                         0, language_unknown, objfile);
                  }
                  }
                continue;
                continue;
              }
              }
            case DNTT_TYPE_MEMENUM:
            case DNTT_TYPE_MEMENUM:
            case DNTT_TYPE_CONST:
            case DNTT_TYPE_CONST:
              /* Constants and members of enumerated types.  */
              /* Constants and members of enumerated types.  */
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              if (!pst)
              if (!pst)
                {
                {
                  pst = hpread_start_psymtab (objfile,
                  pst = hpread_start_psymtab (objfile,
                                              "globals", 0,
                                              "globals", 0,
                                              (hp_symnum
                                              (hp_symnum
                                         * sizeof (struct dntt_type_block)),
                                         * sizeof (struct dntt_type_block)),
                                              objfile->global_psymbols.next,
                                              objfile->global_psymbols.next,
                                              objfile->static_psymbols.next);
                                              objfile->static_psymbols.next);
                }
                }
              add_psymbol_to_list (namestring, strlen (namestring),
              add_psymbol_to_list (namestring, strlen (namestring),
                                   VAR_NAMESPACE, LOC_CONST,
                                   VAR_NAMESPACE, LOC_CONST,
                                   &objfile->static_psymbols, 0,
                                   &objfile->static_psymbols, 0,
                                   0, language_unknown, objfile);
                                   0, language_unknown, objfile);
              continue;
              continue;
            default:
            default:
              continue;
              continue;
            }
            }
        }
        }
    }
    }
 
 
  /* End any pending partial symbol table.  */
  /* End any pending partial symbol table.  */
  if (pst)
  if (pst)
    {
    {
      hpread_end_psymtab (pst, psymtab_include_list, includes_used,
      hpread_end_psymtab (pst, psymtab_include_list, includes_used,
                          hp_symnum * sizeof (struct dntt_type_block),
                          hp_symnum * sizeof (struct dntt_type_block),
                          0, dependency_list, dependencies_used);
                          0, dependency_list, dependencies_used);
    }
    }
 
 
  discard_cleanups (old_chain);
  discard_cleanups (old_chain);
}
}
 
 
/* Perform any local cleanups required when we are done with a particular
/* Perform any local cleanups required when we are done with a particular
   objfile.  I.E, we are in the process of discarding all symbol information
   objfile.  I.E, we are in the process of discarding all symbol information
   for an objfile, freeing up all memory held for it, and unlinking the
   for an objfile, freeing up all memory held for it, and unlinking the
   objfile struct from the global list of known objfiles. */
   objfile struct from the global list of known objfiles. */
 
 
void
void
hpread_symfile_finish (objfile)
hpread_symfile_finish (objfile)
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  if (objfile->sym_private != NULL)
  if (objfile->sym_private != NULL)
    {
    {
      mfree (objfile->md, objfile->sym_private);
      mfree (objfile->md, objfile->sym_private);
    }
    }
}
}


 
 
/* The remaining functions are all for internal use only.  */
/* The remaining functions are all for internal use only.  */
 
 
/* Various small functions to get entries in the debug symbol sections.  */
/* Various small functions to get entries in the debug symbol sections.  */
 
 
static union dnttentry *
static union dnttentry *
hpread_get_lntt (index, objfile)
hpread_get_lntt (index, objfile)
     int index;
     int index;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  return (union dnttentry *)
  return (union dnttentry *)
    &(LNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
    &(LNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
}
}
 
 
static union dnttentry *
static union dnttentry *
hpread_get_gntt (index, objfile)
hpread_get_gntt (index, objfile)
     int index;
     int index;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  return (union dnttentry *)
  return (union dnttentry *)
    &(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
    &(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
}
}
 
 
static union sltentry *
static union sltentry *
hpread_get_slt (index, objfile)
hpread_get_slt (index, objfile)
     int index;
     int index;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]);
  return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]);
}
}
 
 
/* Get the low address associated with some symbol (typically the start
/* Get the low address associated with some symbol (typically the start
   of a particular source file or module).  Since that information is not
   of a particular source file or module).  Since that information is not
   stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we must infer it from
   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.  */
   the existance of DNTT_TYPE_FUNCTION symbols.  */
 
 
static unsigned long
static unsigned long
hpread_get_textlow (global, index, objfile)
hpread_get_textlow (global, index, objfile)
     int global;
     int global;
     int index;
     int index;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  union dnttentry *dn_bufp;
  union dnttentry *dn_bufp;
  struct minimal_symbol *msymbol;
  struct minimal_symbol *msymbol;
 
 
  /* Look for a DNTT_TYPE_FUNCTION symbol.  */
  /* Look for a DNTT_TYPE_FUNCTION symbol.  */
  do
  do
    {
    {
      if (global)
      if (global)
        dn_bufp = hpread_get_gntt (index++, objfile);
        dn_bufp = hpread_get_gntt (index++, objfile);
      else
      else
        dn_bufp = hpread_get_lntt (index++, objfile);
        dn_bufp = hpread_get_lntt (index++, objfile);
    }
    }
  while (dn_bufp->dblock.kind != DNTT_TYPE_FUNCTION
  while (dn_bufp->dblock.kind != DNTT_TYPE_FUNCTION
         && dn_bufp->dblock.kind != DNTT_TYPE_END);
         && dn_bufp->dblock.kind != DNTT_TYPE_END);
 
 
  /* Avoid going past a DNTT_TYPE_END when looking for a DNTT_TYPE_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.  */
     might happen when a sourcefile has no functions.  */
  if (dn_bufp->dblock.kind == DNTT_TYPE_END)
  if (dn_bufp->dblock.kind == DNTT_TYPE_END)
    return 0;
    return 0;
 
 
  /* The minimal symbols are typically more accurate for some reason.  */
  /* The minimal symbols are typically more accurate for some reason.  */
  msymbol = lookup_minimal_symbol (dn_bufp->dfunc.name + VT (objfile), NULL,
  msymbol = lookup_minimal_symbol (dn_bufp->dfunc.name + VT (objfile), NULL,
                                   objfile);
                                   objfile);
  if (msymbol)
  if (msymbol)
    return SYMBOL_VALUE_ADDRESS (msymbol);
    return SYMBOL_VALUE_ADDRESS (msymbol);
  else
  else
    return dn_bufp->dfunc.lowaddr;
    return dn_bufp->dfunc.lowaddr;
}
}
 
 
/* Get the nesting depth for the source line identified by INDEX.  */
/* Get the nesting depth for the source line identified by INDEX.  */
 
 
static unsigned long
static unsigned long
hpread_get_depth (index, objfile)
hpread_get_depth (index, objfile)
     sltpointer index;
     sltpointer index;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  union sltentry *sl_bufp;
  union sltentry *sl_bufp;
 
 
  sl_bufp = hpread_get_slt (index, objfile);
  sl_bufp = hpread_get_slt (index, objfile);
  return sl_bufp->sspec.backptr.dnttp.index;
  return sl_bufp->sspec.backptr.dnttp.index;
}
}
 
 
/* Get the source line number the the line identified by INDEX.  */
/* Get the source line number the the line identified by INDEX.  */
 
 
static unsigned long
static unsigned long
hpread_get_line (index, objfile)
hpread_get_line (index, objfile)
     sltpointer index;
     sltpointer index;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  union sltentry *sl_bufp;
  union sltentry *sl_bufp;
 
 
  sl_bufp = hpread_get_slt (index, objfile);
  sl_bufp = hpread_get_slt (index, objfile);
  return sl_bufp->snorm.line;
  return sl_bufp->snorm.line;
}
}
 
 
static CORE_ADDR
static CORE_ADDR
hpread_get_location (index, objfile)
hpread_get_location (index, objfile)
     sltpointer index;
     sltpointer index;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  union sltentry *sl_bufp;
  union sltentry *sl_bufp;
  int i;
  int i;
 
 
  /* code location of special sltentrys is determined from context */
  /* code location of special sltentrys is determined from context */
  sl_bufp = hpread_get_slt (index, objfile);
  sl_bufp = hpread_get_slt (index, objfile);
 
 
  if (sl_bufp->snorm.sltdesc == SLT_END)
  if (sl_bufp->snorm.sltdesc == SLT_END)
    {
    {
      /* find previous normal sltentry and get address */
      /* find previous normal sltentry and get address */
      for (i = 0; ((sl_bufp->snorm.sltdesc != SLT_NORMAL) &&
      for (i = 0; ((sl_bufp->snorm.sltdesc != SLT_NORMAL) &&
                   (sl_bufp->snorm.sltdesc != SLT_EXIT)); i++)
                   (sl_bufp->snorm.sltdesc != SLT_EXIT)); i++)
        sl_bufp = hpread_get_slt (index - i, objfile);
        sl_bufp = hpread_get_slt (index - i, objfile);
      return sl_bufp->snorm.address;
      return sl_bufp->snorm.address;
    }
    }
 
 
  /* find next normal sltentry and get address */
  /* find next normal sltentry and get address */
  for (i = 0; ((sl_bufp->snorm.sltdesc != SLT_NORMAL) &&
  for (i = 0; ((sl_bufp->snorm.sltdesc != SLT_NORMAL) &&
               (sl_bufp->snorm.sltdesc != SLT_EXIT)); i++)
               (sl_bufp->snorm.sltdesc != SLT_EXIT)); i++)
    sl_bufp = hpread_get_slt (index + i, objfile);
    sl_bufp = hpread_get_slt (index + i, objfile);
  return sl_bufp->snorm.address;
  return sl_bufp->snorm.address;
}
}


 
 
/* Return 1 if an HP debug symbol of type KIND has a name associated with
/* Return 1 if an HP debug symbol of type KIND has a name associated with
   it, else return 0.  */
   it, else return 0.  */
 
 
static int
static int
hpread_has_name (kind)
hpread_has_name (kind)
     enum dntt_entry_type kind;
     enum dntt_entry_type kind;
{
{
  switch (kind)
  switch (kind)
    {
    {
    case DNTT_TYPE_SRCFILE:
    case DNTT_TYPE_SRCFILE:
    case DNTT_TYPE_MODULE:
    case DNTT_TYPE_MODULE:
    case DNTT_TYPE_FUNCTION:
    case DNTT_TYPE_FUNCTION:
    case DNTT_TYPE_ENTRY:
    case DNTT_TYPE_ENTRY:
    case DNTT_TYPE_IMPORT:
    case DNTT_TYPE_IMPORT:
    case DNTT_TYPE_LABEL:
    case DNTT_TYPE_LABEL:
    case DNTT_TYPE_FPARAM:
    case DNTT_TYPE_FPARAM:
    case DNTT_TYPE_SVAR:
    case DNTT_TYPE_SVAR:
    case DNTT_TYPE_DVAR:
    case DNTT_TYPE_DVAR:
    case DNTT_TYPE_CONST:
    case DNTT_TYPE_CONST:
    case DNTT_TYPE_TYPEDEF:
    case DNTT_TYPE_TYPEDEF:
    case DNTT_TYPE_TAGDEF:
    case DNTT_TYPE_TAGDEF:
    case DNTT_TYPE_MEMENUM:
    case DNTT_TYPE_MEMENUM:
    case DNTT_TYPE_FIELD:
    case DNTT_TYPE_FIELD:
    case DNTT_TYPE_SA:
    case DNTT_TYPE_SA:
      return 1;
      return 1;
 
 
    case DNTT_TYPE_BEGIN:
    case DNTT_TYPE_BEGIN:
    case DNTT_TYPE_END:
    case DNTT_TYPE_END:
    case DNTT_TYPE_WITH:
    case DNTT_TYPE_WITH:
    case DNTT_TYPE_COMMON:
    case DNTT_TYPE_COMMON:
    case DNTT_TYPE_POINTER:
    case DNTT_TYPE_POINTER:
    case DNTT_TYPE_ENUM:
    case DNTT_TYPE_ENUM:
    case DNTT_TYPE_SET:
    case DNTT_TYPE_SET:
    case DNTT_TYPE_SUBRANGE:
    case DNTT_TYPE_SUBRANGE:
    case DNTT_TYPE_ARRAY:
    case DNTT_TYPE_ARRAY:
    case DNTT_TYPE_STRUCT:
    case DNTT_TYPE_STRUCT:
    case DNTT_TYPE_UNION:
    case DNTT_TYPE_UNION:
    case DNTT_TYPE_VARIANT:
    case DNTT_TYPE_VARIANT:
    case DNTT_TYPE_FILE:
    case DNTT_TYPE_FILE:
    case DNTT_TYPE_FUNCTYPE:
    case DNTT_TYPE_FUNCTYPE:
    case DNTT_TYPE_COBSTRUCT:
    case DNTT_TYPE_COBSTRUCT:
    case DNTT_TYPE_XREF:
    case DNTT_TYPE_XREF:
    case DNTT_TYPE_MACRO:
    case DNTT_TYPE_MACRO:
    default:
    default:
      return 0;
      return 0;
    }
    }
}
}
 
 
/* Allocate and partially fill a partial symtab.  It will be
/* Allocate and partially fill a partial symtab.  It will be
   completely filled at the end of the symbol list.
   completely filled at the end of the symbol list.
 
 
   SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
   SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
   is the address relative to which its symbols are (incremental) or 0
   is the address relative to which its symbols are (incremental) or 0
   (normal). */
   (normal). */
 
 
static struct partial_symtab *
static struct partial_symtab *
hpread_start_psymtab (objfile, filename, textlow, ldsymoff, global_syms,
hpread_start_psymtab (objfile, filename, textlow, ldsymoff, global_syms,
                      static_syms)
                      static_syms)
     struct objfile *objfile;
     struct objfile *objfile;
     char *filename;
     char *filename;
     CORE_ADDR textlow;
     CORE_ADDR textlow;
     int ldsymoff;
     int ldsymoff;
     struct partial_symbol **global_syms;
     struct partial_symbol **global_syms;
     struct partial_symbol **static_syms;
     struct partial_symbol **static_syms;
{
{
  struct partial_symtab *result =
  struct partial_symtab *result =
  start_psymtab_common (objfile, section_offsets,
  start_psymtab_common (objfile, section_offsets,
                        filename, textlow, global_syms, static_syms);
                        filename, textlow, global_syms, static_syms);
 
 
  result->read_symtab_private = (char *)
  result->read_symtab_private = (char *)
    obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
    obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
  LDSYMOFF (result) = ldsymoff;
  LDSYMOFF (result) = ldsymoff;
  result->read_symtab = hpread_psymtab_to_symtab;
  result->read_symtab = hpread_psymtab_to_symtab;
 
 
  return result;
  return result;
}
}


 
 
/* Close off the current usage of PST.
/* Close off the current usage of PST.
   Returns PST or NULL if the partial symtab was empty and thrown away.
   Returns PST or NULL if the partial symtab was empty and thrown away.
 
 
   FIXME:  List variables and peculiarities of same.  */
   FIXME:  List variables and peculiarities of same.  */
 
 
static struct partial_symtab *
static struct partial_symtab *
hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
                    capping_text, dependency_list, number_dependencies)
                    capping_text, dependency_list, number_dependencies)
     struct partial_symtab *pst;
     struct partial_symtab *pst;
     char **include_list;
     char **include_list;
     int num_includes;
     int num_includes;
     int capping_symbol_offset;
     int capping_symbol_offset;
     CORE_ADDR capping_text;
     CORE_ADDR capping_text;
     struct partial_symtab **dependency_list;
     struct partial_symtab **dependency_list;
     int number_dependencies;
     int number_dependencies;
{
{
  int i;
  int i;
  struct objfile *objfile = pst->objfile;
  struct objfile *objfile = pst->objfile;
 
 
  if (capping_symbol_offset != -1)
  if (capping_symbol_offset != -1)
    LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst);
    LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst);
  pst->texthigh = capping_text;
  pst->texthigh = capping_text;
 
 
  pst->n_global_syms =
  pst->n_global_syms =
    objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset);
    objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset);
  pst->n_static_syms =
  pst->n_static_syms =
    objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset);
    objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset);
 
 
  pst->number_of_dependencies = number_dependencies;
  pst->number_of_dependencies = number_dependencies;
  if (number_dependencies)
  if (number_dependencies)
    {
    {
      pst->dependencies = (struct partial_symtab **)
      pst->dependencies = (struct partial_symtab **)
        obstack_alloc (&objfile->psymbol_obstack,
        obstack_alloc (&objfile->psymbol_obstack,
                    number_dependencies * sizeof (struct partial_symtab *));
                    number_dependencies * sizeof (struct partial_symtab *));
      memcpy (pst->dependencies, dependency_list,
      memcpy (pst->dependencies, dependency_list,
              number_dependencies * sizeof (struct partial_symtab *));
              number_dependencies * sizeof (struct partial_symtab *));
    }
    }
  else
  else
    pst->dependencies = 0;
    pst->dependencies = 0;
 
 
  for (i = 0; i < num_includes; i++)
  for (i = 0; i < num_includes; i++)
    {
    {
      struct partial_symtab *subpst =
      struct partial_symtab *subpst =
      allocate_psymtab (include_list[i], objfile);
      allocate_psymtab (include_list[i], objfile);
 
 
      subpst->section_offsets = pst->section_offsets;
      subpst->section_offsets = pst->section_offsets;
      subpst->read_symtab_private =
      subpst->read_symtab_private =
        (char *) obstack_alloc (&objfile->psymbol_obstack,
        (char *) obstack_alloc (&objfile->psymbol_obstack,
                                sizeof (struct symloc));
                                sizeof (struct symloc));
      LDSYMOFF (subpst) =
      LDSYMOFF (subpst) =
        LDSYMLEN (subpst) =
        LDSYMLEN (subpst) =
        subpst->textlow =
        subpst->textlow =
        subpst->texthigh = 0;
        subpst->texthigh = 0;
 
 
      /* We could save slight bits of space by only making one of these,
      /* We could save slight bits of space by only making one of these,
         shared by the entire set of include files.  FIXME-someday.  */
         shared by the entire set of include files.  FIXME-someday.  */
      subpst->dependencies = (struct partial_symtab **)
      subpst->dependencies = (struct partial_symtab **)
        obstack_alloc (&objfile->psymbol_obstack,
        obstack_alloc (&objfile->psymbol_obstack,
                       sizeof (struct partial_symtab *));
                       sizeof (struct partial_symtab *));
      subpst->dependencies[0] = pst;
      subpst->dependencies[0] = pst;
      subpst->number_of_dependencies = 1;
      subpst->number_of_dependencies = 1;
 
 
      subpst->globals_offset =
      subpst->globals_offset =
        subpst->n_global_syms =
        subpst->n_global_syms =
        subpst->statics_offset =
        subpst->statics_offset =
        subpst->n_static_syms = 0;
        subpst->n_static_syms = 0;
 
 
      subpst->readin = 0;
      subpst->readin = 0;
      subpst->symtab = 0;
      subpst->symtab = 0;
      subpst->read_symtab = pst->read_symtab;
      subpst->read_symtab = pst->read_symtab;
    }
    }
 
 
  sort_pst_symbols (pst);
  sort_pst_symbols (pst);
 
 
  /* If there is already a psymtab or symtab for a file of this name, remove it.
  /* If there is already a psymtab or symtab for a file of this name, remove it.
     (If there is a symtab, more drastic things also happen.)
     (If there is a symtab, more drastic things also happen.)
     This happens in VxWorks.  */
     This happens in VxWorks.  */
  free_named_symtabs (pst->filename);
  free_named_symtabs (pst->filename);
 
 
  if (num_includes == 0
  if (num_includes == 0
      && number_dependencies == 0
      && number_dependencies == 0
      && pst->n_global_syms == 0
      && pst->n_global_syms == 0
      && pst->n_static_syms == 0)
      && pst->n_static_syms == 0)
    {
    {
      /* Throw away this psymtab, it's empty.  We can't deallocate it, since
      /* Throw away this psymtab, it's empty.  We can't deallocate it, since
         it is on the obstack, but we can forget to chain it on the list.  */
         it is on the obstack, but we can forget to chain it on the list.  */
      /* Empty psymtabs happen as a result of header files which don't have
      /* Empty psymtabs happen as a result of header files which don't have
         any symbols in them.  There can be a lot of them.  But this check
         any symbols in them.  There can be a lot of them.  But this check
         is wrong, in that a psymtab with N_SLINE entries but nothing else
         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
         is not empty, but we don't realize that.  Fixing that without slowing
         things down might be tricky.  */
         things down might be tricky.  */
 
 
      discard_psymtab (pst);
      discard_psymtab (pst);
 
 
      /* Indicate that psymtab was thrown away.  */
      /* Indicate that psymtab was thrown away.  */
      pst = (struct partial_symtab *) NULL;
      pst = (struct partial_symtab *) NULL;
    }
    }
  return pst;
  return pst;
}
}


/* Do the dirty work of reading in the full symbol from a partial symbol
/* Do the dirty work of reading in the full symbol from a partial symbol
   table.  */
   table.  */
 
 
static void
static void
hpread_psymtab_to_symtab_1 (pst)
hpread_psymtab_to_symtab_1 (pst)
     struct partial_symtab *pst;
     struct partial_symtab *pst;
{
{
  struct cleanup *old_chain;
  struct cleanup *old_chain;
  int i;
  int i;
 
 
  /* Get out quick if passed junk.  */
  /* Get out quick if passed junk.  */
  if (!pst)
  if (!pst)
    return;
    return;
 
 
  /* Complain if we've already read in this symbol table.  */
  /* Complain if we've already read in this symbol table.  */
  if (pst->readin)
  if (pst->readin)
    {
    {
      fprintf (stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
      fprintf (stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
               pst->filename);
               pst->filename);
      return;
      return;
    }
    }
 
 
  /* Read in all partial symtabs on which this one is dependent */
  /* Read in all partial symtabs on which this one is dependent */
  for (i = 0; i < pst->number_of_dependencies; i++)
  for (i = 0; i < pst->number_of_dependencies; i++)
    if (!pst->dependencies[i]->readin)
    if (!pst->dependencies[i]->readin)
      {
      {
        /* Inform about additional files that need to be read in.  */
        /* Inform about additional files that need to be read in.  */
        if (info_verbose)
        if (info_verbose)
          {
          {
            fputs_filtered (" ", gdb_stdout);
            fputs_filtered (" ", gdb_stdout);
            wrap_here ("");
            wrap_here ("");
            fputs_filtered ("and ", gdb_stdout);
            fputs_filtered ("and ", gdb_stdout);
            wrap_here ("");
            wrap_here ("");
            printf_filtered ("%s...", pst->dependencies[i]->filename);
            printf_filtered ("%s...", pst->dependencies[i]->filename);
            wrap_here ("");     /* Flush output */
            wrap_here ("");     /* Flush output */
            gdb_flush (gdb_stdout);
            gdb_flush (gdb_stdout);
          }
          }
        hpread_psymtab_to_symtab_1 (pst->dependencies[i]);
        hpread_psymtab_to_symtab_1 (pst->dependencies[i]);
      }
      }
 
 
  /* If it's real...  */
  /* If it's real...  */
  if (LDSYMLEN (pst))
  if (LDSYMLEN (pst))
    {
    {
      /* Init stuff necessary for reading in symbols */
      /* Init stuff necessary for reading in symbols */
      buildsym_init ();
      buildsym_init ();
      old_chain = make_cleanup (really_free_pendings, 0);
      old_chain = make_cleanup (really_free_pendings, 0);
 
 
      pst->symtab =
      pst->symtab =
        hpread_expand_symtab (pst->objfile, LDSYMOFF (pst), LDSYMLEN (pst),
        hpread_expand_symtab (pst->objfile, LDSYMOFF (pst), LDSYMLEN (pst),
                              pst->textlow, pst->texthigh - pst->textlow,
                              pst->textlow, pst->texthigh - pst->textlow,
                              pst->section_offsets, pst->filename);
                              pst->section_offsets, pst->filename);
      sort_symtab_syms (pst->symtab);
      sort_symtab_syms (pst->symtab);
 
 
      do_cleanups (old_chain);
      do_cleanups (old_chain);
    }
    }
 
 
  pst->readin = 1;
  pst->readin = 1;
}
}
 
 
/* Read in all of the symbols for a given psymtab for real.
/* Read in all of the symbols for a given psymtab for real.
   Be verbose about it if the user wants that.  */
   Be verbose about it if the user wants that.  */
 
 
static void
static void
hpread_psymtab_to_symtab (pst)
hpread_psymtab_to_symtab (pst)
     struct partial_symtab *pst;
     struct partial_symtab *pst;
{
{
  /* Get out quick if given junk.  */
  /* Get out quick if given junk.  */
  if (!pst)
  if (!pst)
    return;
    return;
 
 
  /* Sanity check.  */
  /* Sanity check.  */
  if (pst->readin)
  if (pst->readin)
    {
    {
      fprintf (stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
      fprintf (stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
               pst->filename);
               pst->filename);
      return;
      return;
    }
    }
 
 
  if (LDSYMLEN (pst) || pst->number_of_dependencies)
  if (LDSYMLEN (pst) || pst->number_of_dependencies)
    {
    {
      /* Print the message now, before reading the string table,
      /* Print the message now, before reading the string table,
         to avoid disconcerting pauses.  */
         to avoid disconcerting pauses.  */
      if (info_verbose)
      if (info_verbose)
        {
        {
          printf_filtered ("Reading in symbols for %s...", pst->filename);
          printf_filtered ("Reading in symbols for %s...", pst->filename);
          gdb_flush (gdb_stdout);
          gdb_flush (gdb_stdout);
        }
        }
 
 
      hpread_psymtab_to_symtab_1 (pst);
      hpread_psymtab_to_symtab_1 (pst);
 
 
      /* Match with global symbols.  This only needs to be done once,
      /* Match with global symbols.  This only needs to be done once,
         after all of the symtabs and dependencies have been read in.   */
         after all of the symtabs and dependencies have been read in.   */
      scan_file_globals (pst->objfile);
      scan_file_globals (pst->objfile);
 
 
      /* Finish up the debug error message.  */
      /* Finish up the debug error message.  */
      if (info_verbose)
      if (info_verbose)
        printf_filtered ("done.\n");
        printf_filtered ("done.\n");
    }
    }
}
}
/* Read in a defined section of a specific object file's symbols.
/* Read in a defined section of a specific object file's symbols.
 
 
   DESC is the file descriptor for the file, positioned at the
   DESC is the file descriptor for the file, positioned at the
   beginning of the symtab
   beginning of the symtab
   SYM_OFFSET is the offset within the file of
   SYM_OFFSET is the offset within the file of
   the beginning of the symbols we want to read
   the beginning of the symbols we want to read
   SYM_SIZE is the size of the symbol info to read in.
   SYM_SIZE is the size of the symbol info to read in.
   TEXT_OFFSET is the beginning of the text segment we are reading symbols for
   TEXT_OFFSET is the beginning of the text segment we are reading symbols for
   TEXT_SIZE is the size of the text segment read in.
   TEXT_SIZE is the size of the text segment read in.
   SECTION_OFFSETS are the relocation offsets which get added to each symbol. */
   SECTION_OFFSETS are the relocation offsets which get added to each symbol. */
 
 
static struct symtab *
static struct symtab *
hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
                      section_offsets, filename)
                      section_offsets, filename)
     struct objfile *objfile;
     struct objfile *objfile;
     int sym_offset;
     int sym_offset;
     int sym_size;
     int sym_size;
     CORE_ADDR text_offset;
     CORE_ADDR text_offset;
     int text_size;
     int text_size;
     struct section_offsets *section_offsets;
     struct section_offsets *section_offsets;
     char *filename;
     char *filename;
{
{
  char *namestring;
  char *namestring;
  union dnttentry *dn_bufp;
  union dnttentry *dn_bufp;
  unsigned max_symnum;
  unsigned max_symnum;
 
 
  int sym_index = sym_offset / sizeof (struct dntt_type_block);
  int sym_index = sym_offset / sizeof (struct dntt_type_block);
 
 
  current_objfile = objfile;
  current_objfile = objfile;
  subfile_stack = 0;
  subfile_stack = 0;
 
 
  last_source_file = 0;
  last_source_file = 0;
 
 
  dn_bufp = hpread_get_lntt (sym_index, objfile);
  dn_bufp = hpread_get_lntt (sym_index, objfile);
  if (!((dn_bufp->dblock.kind == (unsigned char) DNTT_TYPE_SRCFILE) ||
  if (!((dn_bufp->dblock.kind == (unsigned char) DNTT_TYPE_SRCFILE) ||
        (dn_bufp->dblock.kind == (unsigned char) DNTT_TYPE_MODULE)))
        (dn_bufp->dblock.kind == (unsigned char) DNTT_TYPE_MODULE)))
    {
    {
      start_symtab ("globals", NULL, 0);
      start_symtab ("globals", NULL, 0);
      record_debugformat ("HP");
      record_debugformat ("HP");
    }
    }
 
 
  max_symnum = sym_size / sizeof (struct dntt_type_block);
  max_symnum = sym_size / sizeof (struct dntt_type_block);
 
 
  /* Read in and process each debug symbol within the specified range.  */
  /* Read in and process each debug symbol within the specified range.  */
  for (symnum = 0;
  for (symnum = 0;
       symnum < max_symnum;
       symnum < max_symnum;
       symnum++)
       symnum++)
    {
    {
      QUIT;                     /* Allow this to be interruptable */
      QUIT;                     /* Allow this to be interruptable */
      dn_bufp = hpread_get_lntt (sym_index + symnum, objfile);
      dn_bufp = hpread_get_lntt (sym_index + symnum, objfile);
 
 
      if (dn_bufp->dblock.extension)
      if (dn_bufp->dblock.extension)
        continue;
        continue;
 
 
      /* Yow!  We call SET_NAMESTRING on things without names!  */
      /* Yow!  We call SET_NAMESTRING on things without names!  */
      SET_NAMESTRING (dn_bufp, &namestring, objfile);
      SET_NAMESTRING (dn_bufp, &namestring, objfile);
 
 
      hpread_process_one_debug_symbol (dn_bufp, namestring, section_offsets,
      hpread_process_one_debug_symbol (dn_bufp, namestring, section_offsets,
                                       objfile, text_offset, text_size,
                                       objfile, text_offset, text_size,
                                       filename, symnum + sym_index);
                                       filename, symnum + sym_index);
    }
    }
 
 
  current_objfile = NULL;
  current_objfile = NULL;
 
 
  return end_symtab (text_offset + text_size, objfile, 0);
  return end_symtab (text_offset + text_size, objfile, 0);
}
}


 
 
/* Convert basic types from HP debug format into GDB internal format.  */
/* Convert basic types from HP debug format into GDB internal format.  */
 
 
static int
static int
hpread_type_translate (typep)
hpread_type_translate (typep)
     dnttpointer typep;
     dnttpointer typep;
{
{
  if (!typep.dntti.immediate)
  if (!typep.dntti.immediate)
    abort ();
    abort ();
 
 
  switch (typep.dntti.type)
  switch (typep.dntti.type)
    {
    {
    case HP_TYPE_BOOLEAN:
    case HP_TYPE_BOOLEAN:
    case HP_TYPE_BOOLEAN_S300_COMPAT:
    case HP_TYPE_BOOLEAN_S300_COMPAT:
    case HP_TYPE_BOOLEAN_VAX_COMPAT:
    case HP_TYPE_BOOLEAN_VAX_COMPAT:
      return FT_BOOLEAN;
      return FT_BOOLEAN;
      /* Ugh.  No way to distinguish between signed and unsigned chars.  */
      /* Ugh.  No way to distinguish between signed and unsigned chars.  */
    case HP_TYPE_CHAR:
    case HP_TYPE_CHAR:
    case HP_TYPE_WIDE_CHAR:
    case HP_TYPE_WIDE_CHAR:
      return FT_CHAR;
      return FT_CHAR;
    case HP_TYPE_INT:
    case HP_TYPE_INT:
      if (typep.dntti.bitlength <= 8)
      if (typep.dntti.bitlength <= 8)
        return FT_CHAR;
        return FT_CHAR;
      if (typep.dntti.bitlength <= 16)
      if (typep.dntti.bitlength <= 16)
        return FT_SHORT;
        return FT_SHORT;
      if (typep.dntti.bitlength <= 32)
      if (typep.dntti.bitlength <= 32)
        return FT_INTEGER;
        return FT_INTEGER;
      return FT_LONG_LONG;
      return FT_LONG_LONG;
    case HP_TYPE_LONG:
    case HP_TYPE_LONG:
      return FT_LONG;
      return FT_LONG;
    case HP_TYPE_UNSIGNED_LONG:
    case HP_TYPE_UNSIGNED_LONG:
      if (typep.dntti.bitlength <= 8)
      if (typep.dntti.bitlength <= 8)
        return FT_UNSIGNED_CHAR;
        return FT_UNSIGNED_CHAR;
      if (typep.dntti.bitlength <= 16)
      if (typep.dntti.bitlength <= 16)
        return FT_UNSIGNED_SHORT;
        return FT_UNSIGNED_SHORT;
      if (typep.dntti.bitlength <= 32)
      if (typep.dntti.bitlength <= 32)
        return FT_UNSIGNED_LONG;
        return FT_UNSIGNED_LONG;
      return FT_UNSIGNED_LONG_LONG;
      return FT_UNSIGNED_LONG_LONG;
    case HP_TYPE_UNSIGNED_INT:
    case HP_TYPE_UNSIGNED_INT:
      if (typep.dntti.bitlength <= 8)
      if (typep.dntti.bitlength <= 8)
        return FT_UNSIGNED_CHAR;
        return FT_UNSIGNED_CHAR;
      if (typep.dntti.bitlength <= 16)
      if (typep.dntti.bitlength <= 16)
        return FT_UNSIGNED_SHORT;
        return FT_UNSIGNED_SHORT;
      if (typep.dntti.bitlength <= 32)
      if (typep.dntti.bitlength <= 32)
        return FT_UNSIGNED_INTEGER;
        return FT_UNSIGNED_INTEGER;
      return FT_UNSIGNED_LONG_LONG;
      return FT_UNSIGNED_LONG_LONG;
    case HP_TYPE_REAL:
    case HP_TYPE_REAL:
    case HP_TYPE_REAL_3000:
    case HP_TYPE_REAL_3000:
    case HP_TYPE_DOUBLE:
    case HP_TYPE_DOUBLE:
      if (typep.dntti.bitlength == 64)
      if (typep.dntti.bitlength == 64)
        return FT_DBL_PREC_FLOAT;
        return FT_DBL_PREC_FLOAT;
      if (typep.dntti.bitlength == 128)
      if (typep.dntti.bitlength == 128)
        return FT_EXT_PREC_FLOAT;
        return FT_EXT_PREC_FLOAT;
      return FT_FLOAT;
      return FT_FLOAT;
    case HP_TYPE_COMPLEX:
    case HP_TYPE_COMPLEX:
    case HP_TYPE_COMPLEXS3000:
    case HP_TYPE_COMPLEXS3000:
      if (typep.dntti.bitlength == 128)
      if (typep.dntti.bitlength == 128)
        return FT_DBL_PREC_COMPLEX;
        return FT_DBL_PREC_COMPLEX;
      if (typep.dntti.bitlength == 192)
      if (typep.dntti.bitlength == 192)
        return FT_EXT_PREC_COMPLEX;
        return FT_EXT_PREC_COMPLEX;
      return FT_COMPLEX;
      return FT_COMPLEX;
    case HP_TYPE_STRING200:
    case HP_TYPE_STRING200:
    case HP_TYPE_LONGSTRING200:
    case HP_TYPE_LONGSTRING200:
    case HP_TYPE_FTN_STRING_SPEC:
    case HP_TYPE_FTN_STRING_SPEC:
    case HP_TYPE_MOD_STRING_SPEC:
    case HP_TYPE_MOD_STRING_SPEC:
    case HP_TYPE_MOD_STRING_3000:
    case HP_TYPE_MOD_STRING_3000:
    case HP_TYPE_FTN_STRING_S300_COMPAT:
    case HP_TYPE_FTN_STRING_S300_COMPAT:
    case HP_TYPE_FTN_STRING_VAX_COMPAT:
    case HP_TYPE_FTN_STRING_VAX_COMPAT:
      return FT_STRING;
      return FT_STRING;
    default:
    default:
      abort ();
      abort ();
    }
    }
}
}
 
 
/* Return the type associated with the index found in HP_TYPE.  */
/* Return the type associated with the index found in HP_TYPE.  */
 
 
static struct type **
static struct type **
hpread_lookup_type (hp_type, objfile)
hpread_lookup_type (hp_type, objfile)
     dnttpointer hp_type;
     dnttpointer hp_type;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  unsigned old_len;
  unsigned old_len;
  int index = hp_type.dnttp.index;
  int index = hp_type.dnttp.index;
 
 
  if (hp_type.dntti.immediate)
  if (hp_type.dntti.immediate)
    return NULL;
    return NULL;
 
 
  if (index < LNTT_SYMCOUNT (objfile))
  if (index < LNTT_SYMCOUNT (objfile))
    {
    {
      if (index >= TYPE_VECTOR_LENGTH (objfile))
      if (index >= TYPE_VECTOR_LENGTH (objfile))
        {
        {
          old_len = TYPE_VECTOR_LENGTH (objfile);
          old_len = TYPE_VECTOR_LENGTH (objfile);
          if (old_len == 0)
          if (old_len == 0)
            {
            {
              TYPE_VECTOR_LENGTH (objfile) = 100;
              TYPE_VECTOR_LENGTH (objfile) = 100;
              TYPE_VECTOR (objfile) = (struct type **)
              TYPE_VECTOR (objfile) = (struct type **)
                xmmalloc (objfile->md,
                xmmalloc (objfile->md,
                     TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *));
                     TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *));
            }
            }
          while (index >= TYPE_VECTOR_LENGTH (objfile))
          while (index >= TYPE_VECTOR_LENGTH (objfile))
            TYPE_VECTOR_LENGTH (objfile) *= 2;
            TYPE_VECTOR_LENGTH (objfile) *= 2;
          TYPE_VECTOR (objfile) = (struct type **)
          TYPE_VECTOR (objfile) = (struct type **)
            xmrealloc (objfile->md,
            xmrealloc (objfile->md,
                       (char *) TYPE_VECTOR (objfile),
                       (char *) TYPE_VECTOR (objfile),
                   (TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *)));
                   (TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *)));
          memset (&TYPE_VECTOR (objfile)[old_len], 0,
          memset (&TYPE_VECTOR (objfile)[old_len], 0,
                  (TYPE_VECTOR_LENGTH (objfile) - old_len) *
                  (TYPE_VECTOR_LENGTH (objfile) - old_len) *
                  sizeof (struct type *));
                  sizeof (struct type *));
        }
        }
      return &TYPE_VECTOR (objfile)[index];
      return &TYPE_VECTOR (objfile)[index];
    }
    }
  else
  else
    return NULL;
    return NULL;
}
}
 
 
/* Possibly allocate a GDB internal type so we can internalize HP_TYPE.
/* Possibly allocate a GDB internal type so we can internalize HP_TYPE.
   Note we'll just return the address of a GDB internal type if we already
   Note we'll just return the address of a GDB internal type if we already
   have it lying around.  */
   have it lying around.  */
 
 
static struct type *
static struct type *
hpread_alloc_type (hp_type, objfile)
hpread_alloc_type (hp_type, objfile)
     dnttpointer hp_type;
     dnttpointer hp_type;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  struct type **type_addr;
  struct type **type_addr;
 
 
  type_addr = hpread_lookup_type (hp_type, objfile);
  type_addr = hpread_lookup_type (hp_type, objfile);
  if (*type_addr == 0)
  if (*type_addr == 0)
    *type_addr = alloc_type (objfile);
    *type_addr = alloc_type (objfile);
 
 
  TYPE_CPLUS_SPECIFIC (*type_addr)
  TYPE_CPLUS_SPECIFIC (*type_addr)
    = (struct cplus_struct_type *) &cplus_struct_default;
    = (struct cplus_struct_type *) &cplus_struct_default;
  return *type_addr;
  return *type_addr;
}
}
 
 
/* Read a native enumerated type and return it in GDB internal form.  */
/* Read a native enumerated type and return it in GDB internal form.  */
 
 
static struct type *
static struct type *
hpread_read_enum_type (hp_type, dn_bufp, objfile)
hpread_read_enum_type (hp_type, dn_bufp, objfile)
     dnttpointer hp_type;
     dnttpointer hp_type;
     union dnttentry *dn_bufp;
     union dnttentry *dn_bufp;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  struct type *type;
  struct type *type;
  struct pending **symlist, *osyms, *syms;
  struct pending **symlist, *osyms, *syms;
  int o_nsyms, nsyms = 0;
  int o_nsyms, nsyms = 0;
  dnttpointer mem;
  dnttpointer mem;
  union dnttentry *memp;
  union dnttentry *memp;
  char *name;
  char *name;
  long n;
  long n;
  struct symbol *sym;
  struct symbol *sym;
 
 
  type = hpread_alloc_type (hp_type, objfile);
  type = hpread_alloc_type (hp_type, objfile);
  TYPE_LENGTH (type) = 4;
  TYPE_LENGTH (type) = 4;
 
 
  symlist = &file_symbols;
  symlist = &file_symbols;
  osyms = *symlist;
  osyms = *symlist;
  o_nsyms = osyms ? osyms->nsyms : 0;
  o_nsyms = osyms ? osyms->nsyms : 0;
 
 
  /* Get a name for each member and add it to our list of members.  */
  /* Get a name for each member and add it to our list of members.  */
  mem = dn_bufp->denum.firstmem;
  mem = dn_bufp->denum.firstmem;
  while (mem.dnttp.extension && mem.word != DNTTNIL)
  while (mem.dnttp.extension && mem.word != DNTTNIL)
    {
    {
      memp = hpread_get_lntt (mem.dnttp.index, objfile);
      memp = hpread_get_lntt (mem.dnttp.index, objfile);
 
 
      name = VT (objfile) + memp->dmember.name;
      name = VT (objfile) + memp->dmember.name;
      sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
      sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                             sizeof (struct symbol));
                                             sizeof (struct symbol));
      memset (sym, 0, sizeof (struct symbol));
      memset (sym, 0, sizeof (struct symbol));
      SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
      SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
                                        &objfile->symbol_obstack);
                                        &objfile->symbol_obstack);
      SYMBOL_CLASS (sym) = LOC_CONST;
      SYMBOL_CLASS (sym) = LOC_CONST;
      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
      SYMBOL_VALUE (sym) = memp->dmember.value;
      SYMBOL_VALUE (sym) = memp->dmember.value;
      add_symbol_to_list (sym, symlist);
      add_symbol_to_list (sym, symlist);
      nsyms++;
      nsyms++;
      mem = memp->dmember.nextmem;
      mem = memp->dmember.nextmem;
    }
    }
 
 
  /* Now that we know more about the enum, fill in more info.  */
  /* Now that we know more about the enum, fill in more info.  */
  TYPE_CODE (type) = TYPE_CODE_ENUM;
  TYPE_CODE (type) = TYPE_CODE_ENUM;
  TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
  TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
  TYPE_NFIELDS (type) = nsyms;
  TYPE_NFIELDS (type) = nsyms;
  TYPE_FIELDS (type) = (struct field *)
  TYPE_FIELDS (type) = (struct field *)
    obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nsyms);
    obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nsyms);
 
 
  /* Find the symbols for the members and put them into the type.
  /* Find the symbols for the members and put them into the type.
     The symbols can be found in the symlist that we put them on
     The symbols can be found in the symlist that we put them on
     to cause them to be defined.  osyms contains the old value
     to cause them to be defined.  osyms contains the old value
     of that symlist; everything up to there was defined by us.
     of that symlist; everything up to there was defined by us.
 
 
     Note that we preserve the order of the enum constants, so
     Note that we preserve the order of the enum constants, so
     that in something like "enum {FOO, LAST_THING=FOO}" we print
     that in something like "enum {FOO, LAST_THING=FOO}" we print
     FOO, not LAST_THING.  */
     FOO, not LAST_THING.  */
  for (syms = *symlist, n = 0; syms; syms = syms->next)
  for (syms = *symlist, n = 0; syms; syms = syms->next)
    {
    {
      int j = 0;
      int j = 0;
      if (syms == osyms)
      if (syms == osyms)
        j = o_nsyms;
        j = o_nsyms;
      for (; j < syms->nsyms; j++, n++)
      for (; j < syms->nsyms; j++, n++)
        {
        {
          struct symbol *xsym = syms->symbol[j];
          struct symbol *xsym = syms->symbol[j];
          SYMBOL_TYPE (xsym) = type;
          SYMBOL_TYPE (xsym) = type;
          TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
          TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
          TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
          TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
          TYPE_FIELD_BITSIZE (type, n) = 0;
          TYPE_FIELD_BITSIZE (type, n) = 0;
        }
        }
      if (syms == osyms)
      if (syms == osyms)
        break;
        break;
    }
    }
 
 
  return type;
  return type;
}
}
 
 
/* Read and internalize a native function debug symbol.  */
/* Read and internalize a native function debug symbol.  */
 
 
static struct type *
static struct type *
hpread_read_function_type (hp_type, dn_bufp, objfile)
hpread_read_function_type (hp_type, dn_bufp, objfile)
     dnttpointer hp_type;
     dnttpointer hp_type;
     union dnttentry *dn_bufp;
     union dnttentry *dn_bufp;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  struct type *type, *type1;
  struct type *type, *type1;
  struct pending **symlist, *osyms, *syms;
  struct pending **symlist, *osyms, *syms;
  int o_nsyms, nsyms = 0;
  int o_nsyms, nsyms = 0;
  dnttpointer param;
  dnttpointer param;
  union dnttentry *paramp;
  union dnttentry *paramp;
  char *name;
  char *name;
  long n;
  long n;
  struct symbol *sym;
  struct symbol *sym;
 
 
  param = dn_bufp->dfunc.firstparam;
  param = dn_bufp->dfunc.firstparam;
 
 
  /* See if we've already read in this type.  */
  /* See if we've already read in this type.  */
  type = hpread_alloc_type (hp_type, objfile);
  type = hpread_alloc_type (hp_type, objfile);
  if (TYPE_CODE (type) == TYPE_CODE_FUNC)
  if (TYPE_CODE (type) == TYPE_CODE_FUNC)
    return type;
    return type;
 
 
  /* Nope, so read it in and store it away.  */
  /* Nope, so read it in and store it away.  */
  type1 = lookup_function_type (hpread_type_lookup (dn_bufp->dfunc.retval,
  type1 = lookup_function_type (hpread_type_lookup (dn_bufp->dfunc.retval,
                                                    objfile));
                                                    objfile));
  memcpy ((char *) type, (char *) type1, sizeof (struct type));
  memcpy ((char *) type, (char *) type1, sizeof (struct type));
 
 
  symlist = &local_symbols;
  symlist = &local_symbols;
  osyms = *symlist;
  osyms = *symlist;
  o_nsyms = osyms ? osyms->nsyms : 0;
  o_nsyms = osyms ? osyms->nsyms : 0;
 
 
  /* Now examine each parameter noting its type, location, and a
  /* Now examine each parameter noting its type, location, and a
     wealth of other information.  */
     wealth of other information.  */
  while (param.word && param.word != DNTTNIL)
  while (param.word && param.word != DNTTNIL)
    {
    {
      paramp = hpread_get_lntt (param.dnttp.index, objfile);
      paramp = hpread_get_lntt (param.dnttp.index, objfile);
      nsyms++;
      nsyms++;
      param = paramp->dfparam.nextparam;
      param = paramp->dfparam.nextparam;
 
 
      /* Get the name.  */
      /* Get the name.  */
      name = VT (objfile) + paramp->dfparam.name;
      name = VT (objfile) + paramp->dfparam.name;
      sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
      sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                             sizeof (struct symbol));
                                             sizeof (struct symbol));
      (void) memset (sym, 0, sizeof (struct symbol));
      (void) memset (sym, 0, sizeof (struct symbol));
      SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
      SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
                                        &objfile->symbol_obstack);
                                        &objfile->symbol_obstack);
 
 
      /* Figure out where it lives.  */
      /* Figure out where it lives.  */
      if (paramp->dfparam.regparam)
      if (paramp->dfparam.regparam)
        SYMBOL_CLASS (sym) = LOC_REGPARM;
        SYMBOL_CLASS (sym) = LOC_REGPARM;
      else if (paramp->dfparam.indirect)
      else if (paramp->dfparam.indirect)
        SYMBOL_CLASS (sym) = LOC_REF_ARG;
        SYMBOL_CLASS (sym) = LOC_REF_ARG;
      else
      else
        SYMBOL_CLASS (sym) = LOC_ARG;
        SYMBOL_CLASS (sym) = LOC_ARG;
      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
      if (paramp->dfparam.copyparam)
      if (paramp->dfparam.copyparam)
        {
        {
          SYMBOL_VALUE (sym) = paramp->dfparam.location;
          SYMBOL_VALUE (sym) = paramp->dfparam.location;
#ifdef HPREAD_ADJUST_STACK_ADDRESS
#ifdef HPREAD_ADJUST_STACK_ADDRESS
          SYMBOL_VALUE (sym)
          SYMBOL_VALUE (sym)
            += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
            += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
#endif
#endif
          /* This is likely a pass-by-invisible reference parameter,
          /* This is likely a pass-by-invisible reference parameter,
             Hack on the symbol class to make GDB happy.  */
             Hack on the symbol class to make GDB happy.  */
          SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
          SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
        }
        }
      else
      else
        SYMBOL_VALUE (sym) = paramp->dfparam.location;
        SYMBOL_VALUE (sym) = paramp->dfparam.location;
 
 
      /* Get its type.  */
      /* Get its type.  */
      SYMBOL_TYPE (sym) = hpread_type_lookup (paramp->dfparam.type, objfile);
      SYMBOL_TYPE (sym) = hpread_type_lookup (paramp->dfparam.type, objfile);
 
 
      /* Add it to the list.  */
      /* Add it to the list.  */
      add_symbol_to_list (sym, symlist);
      add_symbol_to_list (sym, symlist);
    }
    }
 
 
  /* Note how many parameters we found.  */
  /* Note how many parameters we found.  */
  TYPE_NFIELDS (type) = nsyms;
  TYPE_NFIELDS (type) = nsyms;
  TYPE_FIELDS (type) = (struct field *)
  TYPE_FIELDS (type) = (struct field *)
    obstack_alloc (&objfile->type_obstack,
    obstack_alloc (&objfile->type_obstack,
                   sizeof (struct field) * nsyms);
                   sizeof (struct field) * nsyms);
 
 
  /* Find the symbols for the values and put them into the type.
  /* Find the symbols for the values and put them into the type.
     The symbols can be found in the symlist that we put them on
     The symbols can be found in the symlist that we put them on
     to cause them to be defined.  osyms contains the old value
     to cause them to be defined.  osyms contains the old value
     of that symlist; everything up to there was defined by us.  */
     of that symlist; everything up to there was defined by us.  */
  /* Note that we preserve the order of the parameters, so
  /* Note that we preserve the order of the parameters, so
     that in something like "enum {FOO, LAST_THING=FOO}" we print
     that in something like "enum {FOO, LAST_THING=FOO}" we print
     FOO, not LAST_THING.  */
     FOO, not LAST_THING.  */
  for (syms = *symlist, n = 0; syms; syms = syms->next)
  for (syms = *symlist, n = 0; syms; syms = syms->next)
    {
    {
      int j = 0;
      int j = 0;
      if (syms == osyms)
      if (syms == osyms)
        j = o_nsyms;
        j = o_nsyms;
      for (; j < syms->nsyms; j++, n++)
      for (; j < syms->nsyms; j++, n++)
        {
        {
          struct symbol *xsym = syms->symbol[j];
          struct symbol *xsym = syms->symbol[j];
          TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
          TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
          TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
          TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
          TYPE_FIELD_BITPOS (type, n) = n;
          TYPE_FIELD_BITPOS (type, n) = n;
          TYPE_FIELD_BITSIZE (type, n) = 0;
          TYPE_FIELD_BITSIZE (type, n) = 0;
        }
        }
      if (syms == osyms)
      if (syms == osyms)
        break;
        break;
    }
    }
  return type;
  return type;
}
}
 
 
/* Read in and internalize a structure definition.  */
/* Read in and internalize a structure definition.  */
 
 
static struct type *
static struct type *
hpread_read_struct_type (hp_type, dn_bufp, objfile)
hpread_read_struct_type (hp_type, dn_bufp, objfile)
     dnttpointer hp_type;
     dnttpointer hp_type;
     union dnttentry *dn_bufp;
     union dnttentry *dn_bufp;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  struct nextfield
  struct nextfield
    {
    {
      struct nextfield *next;
      struct nextfield *next;
      struct field field;
      struct field field;
    };
    };
 
 
  struct type *type;
  struct type *type;
  struct nextfield *list = 0;
  struct nextfield *list = 0;
  struct nextfield *new;
  struct nextfield *new;
  int n, nfields = 0;
  int n, nfields = 0;
  dnttpointer field;
  dnttpointer field;
  union dnttentry *fieldp;
  union dnttentry *fieldp;
 
 
  /* Is it something we've already dealt with?  */
  /* Is it something we've already dealt with?  */
  type = hpread_alloc_type (hp_type, objfile);
  type = hpread_alloc_type (hp_type, objfile);
  if ((TYPE_CODE (type) == TYPE_CODE_STRUCT) ||
  if ((TYPE_CODE (type) == TYPE_CODE_STRUCT) ||
      (TYPE_CODE (type) == TYPE_CODE_UNION))
      (TYPE_CODE (type) == TYPE_CODE_UNION))
    return type;
    return type;
 
 
  /* Get the basic type correct.  */
  /* Get the basic type correct.  */
  if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT)
  if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT)
    {
    {
      TYPE_CODE (type) = TYPE_CODE_STRUCT;
      TYPE_CODE (type) = TYPE_CODE_STRUCT;
      TYPE_LENGTH (type) = dn_bufp->dstruct.bitlength / 8;
      TYPE_LENGTH (type) = dn_bufp->dstruct.bitlength / 8;
    }
    }
  else if (dn_bufp->dblock.kind == DNTT_TYPE_UNION)
  else if (dn_bufp->dblock.kind == DNTT_TYPE_UNION)
    {
    {
      TYPE_CODE (type) = TYPE_CODE_UNION;
      TYPE_CODE (type) = TYPE_CODE_UNION;
      TYPE_LENGTH (type) = dn_bufp->dunion.bitlength / 8;
      TYPE_LENGTH (type) = dn_bufp->dunion.bitlength / 8;
    }
    }
  else
  else
    return type;
    return type;
 
 
 
 
  TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
  TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
 
 
  /* Read in and internalize all the fields.  */
  /* Read in and internalize all the fields.  */
  field = dn_bufp->dstruct.firstfield;
  field = dn_bufp->dstruct.firstfield;
  while (field.word != DNTTNIL && field.dnttp.extension)
  while (field.word != DNTTNIL && field.dnttp.extension)
    {
    {
      fieldp = hpread_get_lntt (field.dnttp.index, objfile);
      fieldp = hpread_get_lntt (field.dnttp.index, objfile);
 
 
      /* Get space to record the next field's data.  */
      /* Get space to record the next field's data.  */
      new = (struct nextfield *) alloca (sizeof (struct nextfield));
      new = (struct nextfield *) alloca (sizeof (struct nextfield));
      new->next = list;
      new->next = list;
      list = new;
      list = new;
 
 
      list->field.name = VT (objfile) + fieldp->dfield.name;
      list->field.name = VT (objfile) + fieldp->dfield.name;
      FIELD_BITPOS (list->field) = fieldp->dfield.bitoffset;
      FIELD_BITPOS (list->field) = fieldp->dfield.bitoffset;
      if (fieldp->dfield.bitlength % 8)
      if (fieldp->dfield.bitlength % 8)
        FIELD_BITSIZE (list->field) = fieldp->dfield.bitlength;
        FIELD_BITSIZE (list->field) = fieldp->dfield.bitlength;
      else
      else
        FIELD_BITSIZE (list->field) = 0;
        FIELD_BITSIZE (list->field) = 0;
      nfields++;
      nfields++;
      field = fieldp->dfield.nextfield;
      field = fieldp->dfield.nextfield;
      FIELD_TYPE (list->field) = hpread_type_lookup (fieldp->dfield.type,
      FIELD_TYPE (list->field) = hpread_type_lookup (fieldp->dfield.type,
                                                     objfile);
                                                     objfile);
    }
    }
 
 
  TYPE_NFIELDS (type) = nfields;
  TYPE_NFIELDS (type) = nfields;
  TYPE_FIELDS (type) = (struct field *)
  TYPE_FIELDS (type) = (struct field *)
    obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nfields);
    obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nfields);
 
 
  /* Copy the saved-up fields into the field vector.  */
  /* Copy the saved-up fields into the field vector.  */
  for (n = nfields; list; list = list->next)
  for (n = nfields; list; list = list->next)
    {
    {
      n -= 1;
      n -= 1;
      TYPE_FIELD (type, n) = list->field;
      TYPE_FIELD (type, n) = list->field;
    }
    }
  return type;
  return type;
}
}
 
 
/* Read in and internalize a set debug symbol.  */
/* Read in and internalize a set debug symbol.  */
 
 
static struct type *
static struct type *
hpread_read_set_type (hp_type, dn_bufp, objfile)
hpread_read_set_type (hp_type, dn_bufp, objfile)
     dnttpointer hp_type;
     dnttpointer hp_type;
     union dnttentry *dn_bufp;
     union dnttentry *dn_bufp;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  struct type *type;
  struct type *type;
 
 
  /* See if it's something we've already deal with.  */
  /* See if it's something we've already deal with.  */
  type = hpread_alloc_type (hp_type, objfile);
  type = hpread_alloc_type (hp_type, objfile);
  if (TYPE_CODE (type) == TYPE_CODE_SET)
  if (TYPE_CODE (type) == TYPE_CODE_SET)
    return type;
    return type;
 
 
  /* Nope.  Fill in the appropriate fields.  */
  /* Nope.  Fill in the appropriate fields.  */
  TYPE_CODE (type) = TYPE_CODE_SET;
  TYPE_CODE (type) = TYPE_CODE_SET;
  TYPE_LENGTH (type) = dn_bufp->dset.bitlength / 8;
  TYPE_LENGTH (type) = dn_bufp->dset.bitlength / 8;
  TYPE_NFIELDS (type) = 0;
  TYPE_NFIELDS (type) = 0;
  TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->dset.subtype,
  TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->dset.subtype,
                                                objfile);
                                                objfile);
  return type;
  return type;
}
}
 
 
/* Read in and internalize an array debug symbol.  */
/* Read in and internalize an array debug symbol.  */
 
 
static struct type *
static struct type *
hpread_read_array_type (hp_type, dn_bufp, objfile)
hpread_read_array_type (hp_type, dn_bufp, objfile)
     dnttpointer hp_type;
     dnttpointer hp_type;
     union dnttentry *dn_bufp;
     union dnttentry *dn_bufp;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  struct type *type;
  struct type *type;
  union dnttentry save;
  union dnttentry save;
  save = *dn_bufp;
  save = *dn_bufp;
 
 
  /* Why no check here?  Because it kept us from properly determining
  /* Why no check here?  Because it kept us from properly determining
     the size of the array!  */
     the size of the array!  */
  type = hpread_alloc_type (hp_type, objfile);
  type = hpread_alloc_type (hp_type, objfile);
 
 
  TYPE_CODE (type) = TYPE_CODE_ARRAY;
  TYPE_CODE (type) = TYPE_CODE_ARRAY;
 
 
  /* values are not normalized.  */
  /* values are not normalized.  */
  if (!((dn_bufp->darray.arrayisbytes && dn_bufp->darray.elemisbytes)
  if (!((dn_bufp->darray.arrayisbytes && dn_bufp->darray.elemisbytes)
        || (!dn_bufp->darray.arrayisbytes && !dn_bufp->darray.elemisbytes)))
        || (!dn_bufp->darray.arrayisbytes && !dn_bufp->darray.elemisbytes)))
    abort ();
    abort ();
  else if (dn_bufp->darray.arraylength == 0x7fffffff)
  else if (dn_bufp->darray.arraylength == 0x7fffffff)
    {
    {
      /* The HP debug format represents char foo[]; as an array with
      /* The HP debug format represents char foo[]; as an array with
         length 0x7fffffff.  Internally GDB wants to represent this
         length 0x7fffffff.  Internally GDB wants to represent this
         as an array of length zero.  */
         as an array of length zero.  */
      TYPE_LENGTH (type) = 0;
      TYPE_LENGTH (type) = 0;
    }
    }
  else
  else
    TYPE_LENGTH (type) = dn_bufp->darray.arraylength / 8;
    TYPE_LENGTH (type) = dn_bufp->darray.arraylength / 8;
 
 
  TYPE_NFIELDS (type) = 1;
  TYPE_NFIELDS (type) = 1;
  TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->darray.elemtype,
  TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->darray.elemtype,
                                                objfile);
                                                objfile);
  dn_bufp = &save;
  dn_bufp = &save;
  TYPE_FIELDS (type) = (struct field *)
  TYPE_FIELDS (type) = (struct field *)
    obstack_alloc (&objfile->type_obstack, sizeof (struct field));
    obstack_alloc (&objfile->type_obstack, sizeof (struct field));
  TYPE_FIELD_TYPE (type, 0) = hpread_type_lookup (dn_bufp->darray.indextype,
  TYPE_FIELD_TYPE (type, 0) = hpread_type_lookup (dn_bufp->darray.indextype,
                                                  objfile);
                                                  objfile);
  return type;
  return type;
}
}
 
 
/* Read in and internalize a subrange debug symbol.  */
/* Read in and internalize a subrange debug symbol.  */
static struct type *
static struct type *
hpread_read_subrange_type (hp_type, dn_bufp, objfile)
hpread_read_subrange_type (hp_type, dn_bufp, objfile)
     dnttpointer hp_type;
     dnttpointer hp_type;
     union dnttentry *dn_bufp;
     union dnttentry *dn_bufp;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  struct type *type;
  struct type *type;
 
 
  /* Is it something we've already dealt with.  */
  /* Is it something we've already dealt with.  */
  type = hpread_alloc_type (hp_type, objfile);
  type = hpread_alloc_type (hp_type, objfile);
  if (TYPE_CODE (type) == TYPE_CODE_RANGE)
  if (TYPE_CODE (type) == TYPE_CODE_RANGE)
    return type;
    return type;
 
 
  /* Nope, internalize it.  */
  /* Nope, internalize it.  */
  TYPE_CODE (type) = TYPE_CODE_RANGE;
  TYPE_CODE (type) = TYPE_CODE_RANGE;
  TYPE_LENGTH (type) = dn_bufp->dsubr.bitlength / 8;
  TYPE_LENGTH (type) = dn_bufp->dsubr.bitlength / 8;
  TYPE_NFIELDS (type) = 2;
  TYPE_NFIELDS (type) = 2;
  TYPE_FIELDS (type)
  TYPE_FIELDS (type)
    = (struct field *) obstack_alloc (&objfile->type_obstack,
    = (struct field *) obstack_alloc (&objfile->type_obstack,
                                      2 * sizeof (struct field));
                                      2 * sizeof (struct field));
 
 
  if (dn_bufp->dsubr.dyn_low)
  if (dn_bufp->dsubr.dyn_low)
    TYPE_FIELD_BITPOS (type, 0) = 0;
    TYPE_FIELD_BITPOS (type, 0) = 0;
  else
  else
    TYPE_FIELD_BITPOS (type, 0) = dn_bufp->dsubr.lowbound;
    TYPE_FIELD_BITPOS (type, 0) = dn_bufp->dsubr.lowbound;
 
 
  if (dn_bufp->dsubr.dyn_high)
  if (dn_bufp->dsubr.dyn_high)
    TYPE_FIELD_BITPOS (type, 1) = -1;
    TYPE_FIELD_BITPOS (type, 1) = -1;
  else
  else
    TYPE_FIELD_BITPOS (type, 1) = dn_bufp->dsubr.highbound;
    TYPE_FIELD_BITPOS (type, 1) = dn_bufp->dsubr.highbound;
  TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->dsubr.subtype,
  TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->dsubr.subtype,
                                                objfile);
                                                objfile);
  return type;
  return type;
}
}
 
 
static struct type *
static struct type *
hpread_type_lookup (hp_type, objfile)
hpread_type_lookup (hp_type, objfile)
     dnttpointer hp_type;
     dnttpointer hp_type;
     struct objfile *objfile;
     struct objfile *objfile;
{
{
  union dnttentry *dn_bufp;
  union dnttentry *dn_bufp;
 
 
  /* First see if it's a simple builtin type.  */
  /* First see if it's a simple builtin type.  */
  if (hp_type.dntti.immediate)
  if (hp_type.dntti.immediate)
    return lookup_fundamental_type (objfile, hpread_type_translate (hp_type));
    return lookup_fundamental_type (objfile, hpread_type_translate (hp_type));
 
 
  /* Not a builtin type.  We'll have to read it in.  */
  /* Not a builtin type.  We'll have to read it in.  */
  if (hp_type.dnttp.index < LNTT_SYMCOUNT (objfile))
  if (hp_type.dnttp.index < LNTT_SYMCOUNT (objfile))
    dn_bufp = hpread_get_lntt (hp_type.dnttp.index, objfile);
    dn_bufp = hpread_get_lntt (hp_type.dnttp.index, objfile);
  else
  else
    return lookup_fundamental_type (objfile, FT_VOID);
    return lookup_fundamental_type (objfile, FT_VOID);
 
 
  switch (dn_bufp->dblock.kind)
  switch (dn_bufp->dblock.kind)
    {
    {
    case DNTT_TYPE_SRCFILE:
    case DNTT_TYPE_SRCFILE:
    case DNTT_TYPE_MODULE:
    case DNTT_TYPE_MODULE:
    case DNTT_TYPE_FUNCTION:
    case DNTT_TYPE_FUNCTION:
    case DNTT_TYPE_ENTRY:
    case DNTT_TYPE_ENTRY:
    case DNTT_TYPE_BEGIN:
    case DNTT_TYPE_BEGIN:
    case DNTT_TYPE_END:
    case DNTT_TYPE_END:
    case DNTT_TYPE_IMPORT:
    case DNTT_TYPE_IMPORT:
    case DNTT_TYPE_LABEL:
    case DNTT_TYPE_LABEL:
    case DNTT_TYPE_WITH:
    case DNTT_TYPE_WITH:
    case DNTT_TYPE_COMMON:
    case DNTT_TYPE_COMMON:
    case DNTT_TYPE_FPARAM:
    case DNTT_TYPE_FPARAM:
    case DNTT_TYPE_SVAR:
    case DNTT_TYPE_SVAR:
    case DNTT_TYPE_DVAR:
    case DNTT_TYPE_DVAR:
    case DNTT_TYPE_CONST:
    case DNTT_TYPE_CONST:
      /* Opps.  Something went very wrong.  */
      /* Opps.  Something went very wrong.  */
      return lookup_fundamental_type (objfile, FT_VOID);
      return lookup_fundamental_type (objfile, FT_VOID);
 
 
    case DNTT_TYPE_TYPEDEF:
    case DNTT_TYPE_TYPEDEF:
      {
      {
        struct type *structtype = hpread_type_lookup (dn_bufp->dtype.type,
        struct type *structtype = hpread_type_lookup (dn_bufp->dtype.type,
                                                      objfile);
                                                      objfile);
        char *suffix;
        char *suffix;
        suffix = VT (objfile) + dn_bufp->dtype.name;
        suffix = VT (objfile) + dn_bufp->dtype.name;
 
 
        TYPE_CPLUS_SPECIFIC (structtype)
        TYPE_CPLUS_SPECIFIC (structtype)
          = (struct cplus_struct_type *) &cplus_struct_default;
          = (struct cplus_struct_type *) &cplus_struct_default;
        TYPE_NAME (structtype) = suffix;
        TYPE_NAME (structtype) = suffix;
        return structtype;
        return structtype;
      }
      }
 
 
    case DNTT_TYPE_TAGDEF:
    case DNTT_TYPE_TAGDEF:
      {
      {
        /* Just a little different from above.  We have to tack on
        /* Just a little different from above.  We have to tack on
           an identifier of some kind (struct, union, enum, etc).  */
           an identifier of some kind (struct, union, enum, etc).  */
        struct type *structtype = hpread_type_lookup (dn_bufp->dtype.type,
        struct type *structtype = hpread_type_lookup (dn_bufp->dtype.type,
                                                      objfile);
                                                      objfile);
        char *prefix, *suffix;
        char *prefix, *suffix;
        suffix = VT (objfile) + dn_bufp->dtype.name;
        suffix = VT (objfile) + dn_bufp->dtype.name;
 
 
        /* Lookup the next type in the list.  It should be a structure,
        /* Lookup the next type in the list.  It should be a structure,
           union, or enum type.  We will need to attach that to our name.  */
           union, or enum type.  We will need to attach that to our name.  */
        if (dn_bufp->dtype.type.dnttp.index < LNTT_SYMCOUNT (objfile))
        if (dn_bufp->dtype.type.dnttp.index < LNTT_SYMCOUNT (objfile))
          dn_bufp = hpread_get_lntt (dn_bufp->dtype.type.dnttp.index, objfile);
          dn_bufp = hpread_get_lntt (dn_bufp->dtype.type.dnttp.index, objfile);
        else
        else
          abort ();
          abort ();
 
 
        if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT)
        if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT)
          prefix = "struct ";
          prefix = "struct ";
        else if (dn_bufp->dblock.kind == DNTT_TYPE_UNION)
        else if (dn_bufp->dblock.kind == DNTT_TYPE_UNION)
          prefix = "union ";
          prefix = "union ";
        else
        else
          prefix = "enum ";
          prefix = "enum ";
 
 
        /* Build the correct name.  */
        /* Build the correct name.  */
        structtype->name
        structtype->name
          = (char *) obstack_alloc (&objfile->type_obstack,
          = (char *) obstack_alloc (&objfile->type_obstack,
                                    strlen (prefix) + strlen (suffix) + 1);
                                    strlen (prefix) + strlen (suffix) + 1);
        TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix);
        TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix);
        TYPE_NAME (structtype) = strcat (TYPE_NAME (structtype), suffix);
        TYPE_NAME (structtype) = strcat (TYPE_NAME (structtype), suffix);
        TYPE_TAG_NAME (structtype) = suffix;
        TYPE_TAG_NAME (structtype) = suffix;
 
 
        TYPE_CPLUS_SPECIFIC (structtype)
        TYPE_CPLUS_SPECIFIC (structtype)
          = (struct cplus_struct_type *) &cplus_struct_default;
          = (struct cplus_struct_type *) &cplus_struct_default;
 
 
        return structtype;
        return structtype;
      }
      }
    case DNTT_TYPE_POINTER:
    case DNTT_TYPE_POINTER:
      return lookup_pointer_type (hpread_type_lookup (dn_bufp->dptr.pointsto,
      return lookup_pointer_type (hpread_type_lookup (dn_bufp->dptr.pointsto,
                                                      objfile));
                                                      objfile));
    case DNTT_TYPE_ENUM:
    case DNTT_TYPE_ENUM:
      return hpread_read_enum_type (hp_type, dn_bufp, objfile);
      return hpread_read_enum_type (hp_type, dn_bufp, objfile);
    case DNTT_TYPE_MEMENUM:
    case DNTT_TYPE_MEMENUM:
      return lookup_fundamental_type (objfile, FT_VOID);
      return lookup_fundamental_type (objfile, FT_VOID);
    case DNTT_TYPE_SET:
    case DNTT_TYPE_SET:
      return hpread_read_set_type (hp_type, dn_bufp, objfile);
      return hpread_read_set_type (hp_type, dn_bufp, objfile);
    case DNTT_TYPE_SUBRANGE:
    case DNTT_TYPE_SUBRANGE:
      return hpread_read_subrange_type (hp_type, dn_bufp, objfile);
      return hpread_read_subrange_type (hp_type, dn_bufp, objfile);
    case DNTT_TYPE_ARRAY:
    case DNTT_TYPE_ARRAY:
      return hpread_read_array_type (hp_type, dn_bufp, objfile);
      return hpread_read_array_type (hp_type, dn_bufp, objfile);
    case DNTT_TYPE_STRUCT:
    case DNTT_TYPE_STRUCT:
    case DNTT_TYPE_UNION:
    case DNTT_TYPE_UNION:
      return hpread_read_struct_type (hp_type, dn_bufp, objfile);
      return hpread_read_struct_type (hp_type, dn_bufp, objfile);
    case DNTT_TYPE_FIELD:
    case DNTT_TYPE_FIELD:
      return hpread_type_lookup (dn_bufp->dfield.type, objfile);
      return hpread_type_lookup (dn_bufp->dfield.type, objfile);
    case DNTT_TYPE_VARIANT:
    case DNTT_TYPE_VARIANT:
    case DNTT_TYPE_FILE:
    case DNTT_TYPE_FILE:
      return lookup_fundamental_type (objfile, FT_VOID);
      return lookup_fundamental_type (objfile, FT_VOID);
    case DNTT_TYPE_FUNCTYPE:
    case DNTT_TYPE_FUNCTYPE:
      return lookup_function_type (hpread_type_lookup (dn_bufp->dfunctype.retval,
      return lookup_function_type (hpread_type_lookup (dn_bufp->dfunctype.retval,
                                                       objfile));
                                                       objfile));
    case DNTT_TYPE_COBSTRUCT:
    case DNTT_TYPE_COBSTRUCT:
    case DNTT_TYPE_XREF:
    case DNTT_TYPE_XREF:
    case DNTT_TYPE_SA:
    case DNTT_TYPE_SA:
    case DNTT_TYPE_MACRO:
    case DNTT_TYPE_MACRO:
    default:
    default:
      return lookup_fundamental_type (objfile, FT_VOID);
      return lookup_fundamental_type (objfile, FT_VOID);
    }
    }
}
}
 
 
static sltpointer
static sltpointer
hpread_record_lines (subfile, s_idx, e_idx, objfile, offset)
hpread_record_lines (subfile, s_idx, e_idx, objfile, offset)
     struct subfile *subfile;
     struct subfile *subfile;
     sltpointer s_idx, e_idx;
     sltpointer s_idx, e_idx;
     struct objfile *objfile;
     struct objfile *objfile;
     CORE_ADDR offset;
     CORE_ADDR offset;
{
{
  union sltentry *sl_bufp;
  union sltentry *sl_bufp;
 
 
  while (s_idx <= e_idx)
  while (s_idx <= e_idx)
    {
    {
      sl_bufp = hpread_get_slt (s_idx, objfile);
      sl_bufp = hpread_get_slt (s_idx, objfile);
      /* Only record "normal" entries in the SLT.  */
      /* Only record "normal" entries in the SLT.  */
      if (sl_bufp->snorm.sltdesc == SLT_NORMAL
      if (sl_bufp->snorm.sltdesc == SLT_NORMAL
          || sl_bufp->snorm.sltdesc == SLT_EXIT)
          || sl_bufp->snorm.sltdesc == SLT_EXIT)
        record_line (subfile, sl_bufp->snorm.line,
        record_line (subfile, sl_bufp->snorm.line,
                     sl_bufp->snorm.address + offset);
                     sl_bufp->snorm.address + offset);
      s_idx++;
      s_idx++;
    }
    }
  return e_idx;
  return e_idx;
}
}
 
 
/* Internalize one native debug symbol.  */
/* Internalize one native debug symbol.  */
 
 
static void
static void
hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
                                 text_offset, text_size, filename, index)
                                 text_offset, text_size, filename, index)
     union dnttentry *dn_bufp;
     union dnttentry *dn_bufp;
     char *name;
     char *name;
     struct section_offsets *section_offsets;
     struct section_offsets *section_offsets;
     struct objfile *objfile;
     struct objfile *objfile;
     CORE_ADDR text_offset;
     CORE_ADDR text_offset;
     int text_size;
     int text_size;
     char *filename;
     char *filename;
     int index;
     int index;
{
{
  unsigned long desc;
  unsigned long desc;
  int type;
  int type;
  CORE_ADDR valu;
  CORE_ADDR valu;
  int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
  int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
  union dnttentry *dn_temp;
  union dnttentry *dn_temp;
  dnttpointer hp_type;
  dnttpointer hp_type;
  struct symbol *sym;
  struct symbol *sym;
  struct context_stack *new;
  struct context_stack *new;
 
 
  /* Allocate one GDB debug symbol and fill in some default values.  */
  /* Allocate one GDB debug symbol and fill in some default values.  */
  sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
  sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                         sizeof (struct symbol));
                                         sizeof (struct symbol));
  memset (sym, 0, sizeof (struct symbol));
  memset (sym, 0, sizeof (struct symbol));
  SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack);
  SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack);
  SYMBOL_LANGUAGE (sym) = language_auto;
  SYMBOL_LANGUAGE (sym) = language_auto;
  SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
  SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
  SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
  SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
  SYMBOL_LINE (sym) = 0;
  SYMBOL_LINE (sym) = 0;
  SYMBOL_VALUE (sym) = 0;
  SYMBOL_VALUE (sym) = 0;
  SYMBOL_CLASS (sym) = LOC_TYPEDEF;
  SYMBOL_CLASS (sym) = LOC_TYPEDEF;
 
 
  hp_type.dnttp.extension = 1;
  hp_type.dnttp.extension = 1;
  hp_type.dnttp.immediate = 0;
  hp_type.dnttp.immediate = 0;
  hp_type.dnttp.global = 0;
  hp_type.dnttp.global = 0;
  hp_type.dnttp.index = index;
  hp_type.dnttp.index = index;
 
 
  type = dn_bufp->dblock.kind;
  type = dn_bufp->dblock.kind;
 
 
  switch (type)
  switch (type)
    {
    {
    case DNTT_TYPE_SRCFILE:
    case DNTT_TYPE_SRCFILE:
      /* This type of symbol indicates from which source file or include file
      /* This type of symbol indicates from which source file or include file
         the following data comes. If there are no modules it also may
         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
         indicate the start of a new source file, in which case we must
         finish the symbol table of the previous source file
         finish the symbol table of the previous source file
         (if any) and start accumulating a new symbol table.  */
         (if any) and start accumulating a new symbol table.  */
 
 
      valu = text_offset;
      valu = text_offset;
      if (!last_source_file)
      if (!last_source_file)
        {
        {
          start_symtab (name, NULL, valu);
          start_symtab (name, NULL, valu);
          record_debugformat ("HP");
          record_debugformat ("HP");
          SL_INDEX (objfile) = dn_bufp->dsfile.address;
          SL_INDEX (objfile) = dn_bufp->dsfile.address;
        }
        }
      else
      else
        {
        {
          SL_INDEX (objfile) = hpread_record_lines (current_subfile,
          SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                    SL_INDEX (objfile),
                                                    SL_INDEX (objfile),
                                                    dn_bufp->dsfile.address,
                                                    dn_bufp->dsfile.address,
                                                    objfile, offset);
                                                    objfile, offset);
        }
        }
      start_subfile (name, NULL);
      start_subfile (name, NULL);
      break;
      break;
 
 
    case DNTT_TYPE_MODULE:
    case DNTT_TYPE_MODULE:
      /* No need to do anything with these DNTT_TYPE_MODULE symbols anymore.  */
      /* No need to do anything with these DNTT_TYPE_MODULE symbols anymore.  */
      break;
      break;
 
 
    case DNTT_TYPE_FUNCTION:
    case DNTT_TYPE_FUNCTION:
    case DNTT_TYPE_ENTRY:
    case DNTT_TYPE_ENTRY:
      /* A function or secondary entry point.  */
      /* A function or secondary entry point.  */
      valu = dn_bufp->dfunc.lowaddr + offset;
      valu = dn_bufp->dfunc.lowaddr + offset;
      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                SL_INDEX (objfile),
                                                dn_bufp->dfunc.address,
                                                dn_bufp->dfunc.address,
                                                objfile, offset);
                                                objfile, offset);
 
 
      WITHIN_FUNCTION (objfile) = 1;
      WITHIN_FUNCTION (objfile) = 1;
      CURRENT_FUNCTION_VALUE (objfile) = valu;
      CURRENT_FUNCTION_VALUE (objfile) = valu;
 
 
      /* Stack must be empty now.  */
      /* Stack must be empty now.  */
      if (context_stack_depth != 0)
      if (context_stack_depth != 0)
        complain (&lbrac_unmatched_complaint, (char *) symnum);
        complain (&lbrac_unmatched_complaint, (char *) symnum);
      new = push_context (0, valu);
      new = push_context (0, valu);
 
 
      SYMBOL_CLASS (sym) = LOC_BLOCK;
      SYMBOL_CLASS (sym) = LOC_BLOCK;
      SYMBOL_TYPE (sym) = hpread_read_function_type (hp_type, dn_bufp, objfile);
      SYMBOL_TYPE (sym) = hpread_read_function_type (hp_type, dn_bufp, objfile);
      if (dn_bufp->dfunc.global)
      if (dn_bufp->dfunc.global)
        add_symbol_to_list (sym, &global_symbols);
        add_symbol_to_list (sym, &global_symbols);
      else
      else
        add_symbol_to_list (sym, &file_symbols);
        add_symbol_to_list (sym, &file_symbols);
      new->name = sym;
      new->name = sym;
 
 
      /* Search forward to the next scope beginning.  */
      /* Search forward to the next scope beginning.  */
      while (dn_bufp->dblock.kind != DNTT_TYPE_BEGIN)
      while (dn_bufp->dblock.kind != DNTT_TYPE_BEGIN)
        {
        {
          dn_bufp = hpread_get_lntt (++index, objfile);
          dn_bufp = hpread_get_lntt (++index, objfile);
          if (dn_bufp->dblock.extension)
          if (dn_bufp->dblock.extension)
            continue;
            continue;
        }
        }
      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                SL_INDEX (objfile),
                                                dn_bufp->dbegin.address,
                                                dn_bufp->dbegin.address,
                                                objfile, offset);
                                                objfile, offset);
      SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dbegin.address, objfile);
      SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dbegin.address, objfile);
      record_line (current_subfile, SYMBOL_LINE (sym), valu);
      record_line (current_subfile, SYMBOL_LINE (sym), valu);
      break;
      break;
 
 
    case DNTT_TYPE_BEGIN:
    case DNTT_TYPE_BEGIN:
      /* Begin a new scope.  */
      /* Begin a new scope.  */
      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                SL_INDEX (objfile),
                                                dn_bufp->dbegin.address,
                                                dn_bufp->dbegin.address,
                                                objfile, offset);
                                                objfile, offset);
      valu = hpread_get_location (dn_bufp->dbegin.address, objfile);
      valu = hpread_get_location (dn_bufp->dbegin.address, objfile);
      valu += offset;           /* Relocate for dynamic loading */
      valu += offset;           /* Relocate for dynamic loading */
      desc = hpread_get_depth (dn_bufp->dbegin.address, objfile);
      desc = hpread_get_depth (dn_bufp->dbegin.address, objfile);
      new = push_context (desc, valu);
      new = push_context (desc, valu);
      break;
      break;
 
 
    case DNTT_TYPE_END:
    case DNTT_TYPE_END:
      /* End a scope.  */
      /* End a scope.  */
      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
      SL_INDEX (objfile) = hpread_record_lines (current_subfile,
                                                SL_INDEX (objfile),
                                                SL_INDEX (objfile),
                                                dn_bufp->dend.address + 1,
                                                dn_bufp->dend.address + 1,
                                                objfile, offset);
                                                objfile, offset);
      switch (dn_bufp->dend.endkind)
      switch (dn_bufp->dend.endkind)
        {
        {
        case DNTT_TYPE_MODULE:
        case DNTT_TYPE_MODULE:
          /* Ending a module ends the symbol table for that module.  */
          /* Ending a module ends the symbol table for that module.  */
          valu = text_offset + text_size + offset;
          valu = text_offset + text_size + offset;
          (void) end_symtab (valu, objfile, 0);
          (void) end_symtab (valu, objfile, 0);
          break;
          break;
 
 
        case DNTT_TYPE_FUNCTION:
        case DNTT_TYPE_FUNCTION:
          /* Ending a function, well, ends the function's scope.  */
          /* Ending a function, well, ends the function's scope.  */
          dn_temp = hpread_get_lntt (dn_bufp->dend.beginscope.dnttp.index,
          dn_temp = hpread_get_lntt (dn_bufp->dend.beginscope.dnttp.index,
                                     objfile);
                                     objfile);
          valu = dn_temp->dfunc.hiaddr + offset;
          valu = dn_temp->dfunc.hiaddr + offset;
          new = pop_context ();
          new = pop_context ();
          /* Make a block for the local symbols within.  */
          /* Make a block for the local symbols within.  */
          finish_block (new->name, &local_symbols, new->old_blocks,
          finish_block (new->name, &local_symbols, new->old_blocks,
                        new->start_addr, valu, objfile);
                        new->start_addr, valu, objfile);
          WITHIN_FUNCTION (objfile) = 0;
          WITHIN_FUNCTION (objfile) = 0;
          break;
          break;
        case DNTT_TYPE_BEGIN:
        case DNTT_TYPE_BEGIN:
          /* Just ending a local scope.  */
          /* Just ending a local scope.  */
          valu = hpread_get_location (dn_bufp->dend.address, objfile);
          valu = hpread_get_location (dn_bufp->dend.address, objfile);
          /* Why in the hell is this needed?  */
          /* Why in the hell is this needed?  */
          valu += offset + 9;   /* Relocate for dynamic loading */
          valu += offset + 9;   /* Relocate for dynamic loading */
          new = pop_context ();
          new = pop_context ();
          desc = dn_bufp->dend.beginscope.dnttp.index;
          desc = dn_bufp->dend.beginscope.dnttp.index;
          if (desc != new->depth)
          if (desc != new->depth)
            complain (&lbrac_mismatch_complaint, (char *) symnum);
            complain (&lbrac_mismatch_complaint, (char *) symnum);
          /* Make a block for the local symbols within.  */
          /* Make a block for the local symbols within.  */
          finish_block (new->name, &local_symbols, new->old_blocks,
          finish_block (new->name, &local_symbols, new->old_blocks,
                        new->start_addr, valu, objfile);
                        new->start_addr, valu, objfile);
          local_symbols = new->locals;
          local_symbols = new->locals;
          break;
          break;
        }
        }
      break;
      break;
    case DNTT_TYPE_LABEL:
    case DNTT_TYPE_LABEL:
      SYMBOL_NAMESPACE (sym) = LABEL_NAMESPACE;
      SYMBOL_NAMESPACE (sym) = LABEL_NAMESPACE;
      break;
      break;
    case DNTT_TYPE_FPARAM:
    case DNTT_TYPE_FPARAM:
      /* Function parameters.  */
      /* Function parameters.  */
      if (dn_bufp->dfparam.regparam)
      if (dn_bufp->dfparam.regparam)
        SYMBOL_CLASS (sym) = LOC_REGISTER;
        SYMBOL_CLASS (sym) = LOC_REGISTER;
      else
      else
        SYMBOL_CLASS (sym) = LOC_LOCAL;
        SYMBOL_CLASS (sym) = LOC_LOCAL;
      if (dn_bufp->dfparam.copyparam)
      if (dn_bufp->dfparam.copyparam)
        {
        {
          SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
          SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
#ifdef HPREAD_ADJUST_STACK_ADDRESS
#ifdef HPREAD_ADJUST_STACK_ADDRESS
          SYMBOL_VALUE (sym)
          SYMBOL_VALUE (sym)
            += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
            += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
#endif
#endif
        }
        }
      else
      else
        SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
        SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dfparam.type, objfile);
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dfparam.type, objfile);
      add_symbol_to_list (sym, &local_symbols);
      add_symbol_to_list (sym, &local_symbols);
      break;
      break;
    case DNTT_TYPE_SVAR:
    case DNTT_TYPE_SVAR:
      /* Static variables.  */
      /* Static variables.  */
      SYMBOL_CLASS (sym) = LOC_STATIC;
      SYMBOL_CLASS (sym) = LOC_STATIC;
      SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dsvar.location;
      SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dsvar.location;
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dsvar.type, objfile);
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dsvar.type, objfile);
      if (dn_bufp->dsvar.global)
      if (dn_bufp->dsvar.global)
        add_symbol_to_list (sym, &global_symbols);
        add_symbol_to_list (sym, &global_symbols);
      else if (WITHIN_FUNCTION (objfile))
      else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
        add_symbol_to_list (sym, &local_symbols);
      else
      else
        add_symbol_to_list (sym, &file_symbols);
        add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_DVAR:
    case DNTT_TYPE_DVAR:
      /* Dynamic variables.  */
      /* Dynamic variables.  */
      if (dn_bufp->ddvar.regvar)
      if (dn_bufp->ddvar.regvar)
        SYMBOL_CLASS (sym) = LOC_REGISTER;
        SYMBOL_CLASS (sym) = LOC_REGISTER;
      else
      else
        SYMBOL_CLASS (sym) = LOC_LOCAL;
        SYMBOL_CLASS (sym) = LOC_LOCAL;
      SYMBOL_VALUE (sym) = dn_bufp->ddvar.location;
      SYMBOL_VALUE (sym) = dn_bufp->ddvar.location;
#ifdef HPREAD_ADJUST_STACK_ADDRESS
#ifdef HPREAD_ADJUST_STACK_ADDRESS
      SYMBOL_VALUE (sym)
      SYMBOL_VALUE (sym)
        += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
        += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
#endif
#endif
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->ddvar.type, objfile);
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->ddvar.type, objfile);
      if (dn_bufp->ddvar.global)
      if (dn_bufp->ddvar.global)
        add_symbol_to_list (sym, &global_symbols);
        add_symbol_to_list (sym, &global_symbols);
      else if (WITHIN_FUNCTION (objfile))
      else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
        add_symbol_to_list (sym, &local_symbols);
      else
      else
        add_symbol_to_list (sym, &file_symbols);
        add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_CONST:
    case DNTT_TYPE_CONST:
      /* A constant (pascal?).  */
      /* A constant (pascal?).  */
      SYMBOL_CLASS (sym) = LOC_CONST;
      SYMBOL_CLASS (sym) = LOC_CONST;
      SYMBOL_VALUE (sym) = dn_bufp->dconst.location;
      SYMBOL_VALUE (sym) = dn_bufp->dconst.location;
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dconst.type, objfile);
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dconst.type, objfile);
      if (dn_bufp->dconst.global)
      if (dn_bufp->dconst.global)
        add_symbol_to_list (sym, &global_symbols);
        add_symbol_to_list (sym, &global_symbols);
      else if (WITHIN_FUNCTION (objfile))
      else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
        add_symbol_to_list (sym, &local_symbols);
      else
      else
        add_symbol_to_list (sym, &file_symbols);
        add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_TYPEDEF:
    case DNTT_TYPE_TYPEDEF:
      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
      if (dn_bufp->dtype.global)
      if (dn_bufp->dtype.global)
        add_symbol_to_list (sym, &global_symbols);
        add_symbol_to_list (sym, &global_symbols);
      else if (WITHIN_FUNCTION (objfile))
      else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
        add_symbol_to_list (sym, &local_symbols);
      else
      else
        add_symbol_to_list (sym, &file_symbols);
        add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_TAGDEF:
    case DNTT_TYPE_TAGDEF:
      SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
      SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
      SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
      TYPE_NAME (sym->type) = SYMBOL_NAME (sym);
      TYPE_NAME (sym->type) = SYMBOL_NAME (sym);
      TYPE_TAG_NAME (sym->type) = SYMBOL_NAME (sym);
      TYPE_TAG_NAME (sym->type) = SYMBOL_NAME (sym);
      if (dn_bufp->dtype.global)
      if (dn_bufp->dtype.global)
        add_symbol_to_list (sym, &global_symbols);
        add_symbol_to_list (sym, &global_symbols);
      else if (WITHIN_FUNCTION (objfile))
      else if (WITHIN_FUNCTION (objfile))
        add_symbol_to_list (sym, &local_symbols);
        add_symbol_to_list (sym, &local_symbols);
      else
      else
        add_symbol_to_list (sym, &file_symbols);
        add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_POINTER:
    case DNTT_TYPE_POINTER:
      SYMBOL_TYPE (sym) = lookup_pointer_type (hpread_type_lookup
      SYMBOL_TYPE (sym) = lookup_pointer_type (hpread_type_lookup
                                               (dn_bufp->dptr.pointsto,
                                               (dn_bufp->dptr.pointsto,
                                                objfile));
                                                objfile));
      add_symbol_to_list (sym, &file_symbols);
      add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_ENUM:
    case DNTT_TYPE_ENUM:
      SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
      SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
      SYMBOL_TYPE (sym) = hpread_read_enum_type (hp_type, dn_bufp, objfile);
      SYMBOL_TYPE (sym) = hpread_read_enum_type (hp_type, dn_bufp, objfile);
      add_symbol_to_list (sym, &file_symbols);
      add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_MEMENUM:
    case DNTT_TYPE_MEMENUM:
      break;
      break;
    case DNTT_TYPE_SET:
    case DNTT_TYPE_SET:
      SYMBOL_TYPE (sym) = hpread_read_set_type (hp_type, dn_bufp, objfile);
      SYMBOL_TYPE (sym) = hpread_read_set_type (hp_type, dn_bufp, objfile);
      add_symbol_to_list (sym, &file_symbols);
      add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_SUBRANGE:
    case DNTT_TYPE_SUBRANGE:
      SYMBOL_TYPE (sym) = hpread_read_subrange_type (hp_type, dn_bufp,
      SYMBOL_TYPE (sym) = hpread_read_subrange_type (hp_type, dn_bufp,
                                                     objfile);
                                                     objfile);
      add_symbol_to_list (sym, &file_symbols);
      add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_ARRAY:
    case DNTT_TYPE_ARRAY:
      SYMBOL_TYPE (sym) = hpread_read_array_type (hp_type, dn_bufp, objfile);
      SYMBOL_TYPE (sym) = hpread_read_array_type (hp_type, dn_bufp, objfile);
      add_symbol_to_list (sym, &file_symbols);
      add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    case DNTT_TYPE_STRUCT:
    case DNTT_TYPE_STRUCT:
    case DNTT_TYPE_UNION:
    case DNTT_TYPE_UNION:
      SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
      SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
      SYMBOL_TYPE (sym) = hpread_read_struct_type (hp_type, dn_bufp, objfile);
      SYMBOL_TYPE (sym) = hpread_read_struct_type (hp_type, dn_bufp, objfile);
      add_symbol_to_list (sym, &file_symbols);
      add_symbol_to_list (sym, &file_symbols);
      break;
      break;
    default:
    default:
      break;
      break;
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.