* xm-sun3os4.h, xm-sun4os4.h: Enable HAVE_MMAP.
[deliverable/binutils-gdb.git] / gdb / dwarfread.c
index 0f96332fe87330d6a36bafd2ad661bd490470a64..399ff47e59ff1fda3f41f7a77e1f3a4af4afd055 100644 (file)
@@ -1,6 +1,6 @@
 /* DWARF debugging format support for GDB.
-   Copyright (C) 1991 Free Software Foundation, Inc.
-   Written by Fred Fish at Cygnus Support, portions based on dbxread.c,
+   Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+   Written by Fred Fish at Cygnus Support.  Portions based on dbxread.c,
    mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port.
 
 This file is part of GDB.
@@ -36,12 +36,6 @@ put enum constants there.  And dbxread seems to invent a lot of typedefs
 we never see.  Use the new printpsym command to see the partial symbol table
 contents.
 
-FIXME: Change forward declarations of static functions to allow for compilers
-without prototypes.
-
-FIXME: Figure out a better way to tell gdb (all the debug reading routines)
-the names of the gccX_compiled flags.
-
 FIXME: Figure out a better way to tell gdb about the name of the function
 contain the user's entry point (I.E. main())
 
@@ -55,29 +49,22 @@ make this code more flexible and just use shorts, ints, and longs (and their
 sizes) where it seems appropriate.  I.E. we use a short int to hold DWARF
 tags, and assume that the tag size in the file is the same as sizeof(short).
 
-FIXME: Figure out how to get the name of the symbol indicating that a module
-has been compiled with gcc (gcc_compiledXX) in a more portable way than
-hardcoding it into the object file readers.
-
 FIXME: See other FIXME's and "ifdef 0" scattered throughout the code for
 other things to work on, if you get bored. :-)
 
 */
+
 #include <stdio.h>
-#ifdef __STDC__
-#include <stdarg.h>
-#else
 #include <varargs.h>
-#endif
 #include <fcntl.h>
 
 #include "defs.h"
-#include "param.h"
 #include "bfd.h"
 #include "symtab.h"
+#include "gdbtypes.h"
 #include "symfile.h"
-#include "dwarf.h"
-#include "ansidecl.h"
+#include "elf/dwarf.h"
+#include "buildsym.h"
 
 #ifdef MAINTENANCE     /* Define to 1 to compile in some maintenance stuff */
 #define SQUAWK(stuff) dwarfwarn stuff
@@ -91,10 +78,23 @@ other things to work on, if you get bored. :-)
 
 typedef unsigned int DIEREF;   /* Reference to a DIE */
 
-#define GCC_COMPILED_FLAG_SYMBOL "gcc_compiled%"       /* FIXME */
-#define GCC2_COMPILED_FLAG_SYMBOL "gcc2_compiled%"     /* FIXME */
+#ifndef GCC_PRODUCER
+#define GCC_PRODUCER "GNU C "
+#endif
 
 #define STREQ(a,b)             (strcmp(a,b)==0)
+#define STREQN(a,b,n)          (strncmp(a,b,n)==0)
+
+/* The Amiga SVR4 header file <dwarf.h> defines AT_element_list as a
+   FORM_BLOCK2, and this is the value emitted by the AT&T compiler.
+   However, the Issue 2 DWARF specification from AT&T defines it as
+   a FORM_BLOCK4, as does the latest specification from UI/PLSIG.
+   For backwards compatibility with the AT&T compiler produced executables
+   we define AT_short_element_list for this variant. */
+
+#define        AT_short_element_list    (0x00f0|FORM_BLOCK2)
+
+/* External variables referenced. */
 
 extern CORE_ADDR startup_file_start;   /* From blockframe.c */
 extern CORE_ADDR startup_file_end;     /* From blockframe.c */
@@ -127,7 +127,7 @@ extern int info_verbose;            /* From main.c; nonzero => verbose */
    Some fields have a flag <name>_p that is set when the value of the
    field is valid (I.E. we found a matching attribute in the DIE).  Since
    we may want to test for the presence of some attributes in the DIE,
-   such as AT_is_external, without restricting the values of the field,
+   such as AT_low_pc, without restricting the values of the field,
    we need someway to note that we found such an attribute.
    
  */
@@ -152,7 +152,6 @@ struct dieinfo {
   long         at_byte_size;
   short                at_bit_offset;
   long         at_bit_size;
-  BLOCK *      at_deriv_list;
   BLOCK *      at_element_list;
   long         at_stmt_list;
   long         at_low_pc;
@@ -166,17 +165,14 @@ struct dieinfo {
   BLOCK *      at_string_length;
   char *       at_comp_dir;
   char *       at_producer;
-  long         at_loclist;
   long         at_frame_base;
-  short                at_incomplete;
   long         at_start_scope;
   long         at_stride_size;
   long         at_src_info;
   short                at_prototyped;
-  BLOCK *      at_const_data;
-  short                at_is_external;
-  unsigned int at_is_external_p:1;
-  unsigned int at_stmt_list_p:1;
+  unsigned int has_at_low_pc:1;
+  unsigned int has_at_stmt_list:1;
+  unsigned int short_element_list:1;
 };
 
 static int diecount;   /* Approximate count of dies for compilation unit */
@@ -186,6 +182,7 @@ static char *dbbase;        /* Base pointer to dwarf info */
 static int dbroff;     /* Relative offset from start of .debug section */
 static char *lnbase;   /* Base pointer to line section */
 static int isreg;      /* Kludge to identify register variables */
+static int offreg;     /* Kludge to identify basereg references */
 
 static CORE_ADDR baseaddr;     /* Add to each symbol value */
 
@@ -227,49 +224,16 @@ struct dwfinfo {
 #define DBLENGTH(p) (((struct dwfinfo *)((p)->read_symtab_private))->dblength)
 #define LNFOFF(p) (((struct dwfinfo *)((p)->read_symtab_private))->lnfoff)
 
-/*  Record the symbols defined for each context in a linked list.  We don't
-    create a struct block for the context until we know how long to make it.
-    Global symbols for each file are maintained in the global_symbols list. */
-
-struct pending_symbol {
-  struct pending_symbol *next;         /* Next pending symbol */
-  struct symbol *symbol;               /* The actual symbol */
-};
+/* The generic symbol table building routines have separate lists for
+   file scope symbols and all all other scopes (local scopes).  So
+   we need to select the right one to pass to add_symbol_to_list().
+   We do it by keeping a pointer to the correct list in list_in_scope.
 
-static struct pending_symbol *global_symbols;  /* global funcs and vars */
-static struct block *global_symbol_block;
-
-/*  Line number entries are read into a dynamically expandable vector before
-    being added to the symbol table section.  Once we know how many there are
-    we can add them. */
-
-static struct linetable *line_vector;  /* Vector of line numbers. */
-static int line_vector_index;          /* Index of next entry.  */
-static int line_vector_length;         /* Current allocation limit */
-
-/* Scope information is kept in a scope tree, one node per scope.  Each time
-   a new scope is started, a child node is created under the current node
-   and set to the current scope.  Each time a scope is closed, the current
-   scope moves back up the tree to the parent of the current scope.
-
-   Each scope contains a pointer to the list of symbols defined in the scope,
-   a pointer to the block vector for the scope, a pointer to the symbol
-   that names the scope (if any), and the range of PC values that mark
-   the start and end of the scope.  */
-
-struct scopenode {
-    struct scopenode *parent;
-    struct scopenode *child;
-    struct scopenode *sibling;
-    struct pending_symbol *symbols;
-    struct block *block;
-    struct symbol *namesym;
-    CORE_ADDR lowpc;
-    CORE_ADDR highpc;
-};
+   FIXME:  The original dwarf code just treated the file scope as the first
+   local scope, and all other local scopes as nested local scopes, and worked
+   fine.  Check to see if we really need to distinguish these in buildsym.c */
 
-static struct scopenode *scopetree;
-static struct scopenode *scope;
+struct pending **list_in_scope = &file_symbols;
 
 /* DIES which have user defined types or modified user defined types refer to
    other DIES for the type information.  Thus we need to associate the offset
@@ -298,167 +262,119 @@ static struct type **utypes;    /* Pointer to array of user type pointers */
 static int numutypes;          /* Max number of user type pointers */
 
 /* Forward declarations of static functions so we don't have to worry
-   about ordering within this file.  The EXFUN macro may be slightly
-   misleading.  Should probably be called DCLFUN instead, or something
-   more intuitive, since it can be used for both static and external
-   definitions. */
+   about ordering within this file.  */
 
 static void
-EXFUN (dwarfwarn, (char *fmt DOTS));
+add_enum_psymbol PARAMS ((struct dieinfo *, struct objfile *));
 
 static void
-EXFUN (scan_partial_symbols, (char *thisdie AND char *enddie));
+read_file_scope PARAMS ((struct dieinfo *, char *, char *, struct objfile *));
 
 static void
-EXFUN (scan_compilation_units,
-       (char *filename AND CORE_ADDR addr AND char *thisdie AND char *enddie
-       AND unsigned int dbfoff AND unsigned int lnoffset
-        AND struct objfile *objfile));
-
-static struct partial_symtab *
-EXFUN(start_psymtab, (struct objfile *objfile AND CORE_ADDR addr
-                     AND char *filename AND CORE_ADDR textlow
-                     AND CORE_ADDR texthigh AND int dbfoff
-                     AND int curoff AND int culength AND int lnfoff
-                     AND struct partial_symbol *global_syms
-                     AND struct partial_symbol *static_syms));
-static void
-EXFUN(add_partial_symbol, (struct dieinfo *dip));
+read_func_scope PARAMS ((struct dieinfo *, char *, char *, struct objfile *));
 
 static void
-EXFUN(add_psymbol_to_list,
-      (struct psymbol_allocation_list *listp AND char *name
-      AND enum namespace space AND enum address_class class
-      AND CORE_ADDR value));
+read_lexical_block_scope PARAMS ((struct dieinfo *, char *, char *,
+                                 struct objfile *));
 
 static void
-EXFUN(init_psymbol_list, (int total_symbols));
+dwarfwarn ();
 
 static void
-EXFUN(basicdieinfo, (struct dieinfo *dip AND char *diep));
+scan_partial_symbols PARAMS ((char *, char *, struct objfile *));
 
 static void
-EXFUN(completedieinfo, (struct dieinfo *dip));
+scan_compilation_units PARAMS ((char *, char *, char *, unsigned int,
+                               unsigned int, struct objfile *));
 
 static void
-EXFUN(dwarf_psymtab_to_symtab, (struct partial_symtab *pst));
+add_partial_symbol PARAMS ((struct dieinfo *, struct objfile *));
 
 static void
-EXFUN(psymtab_to_symtab_1, (struct partial_symtab *pst));
-
-static struct symtab *
-EXFUN(read_ofile_symtab, (struct partial_symtab *pst));
+init_psymbol_list PARAMS ((struct objfile *, int));
 
 static void
-EXFUN(process_dies,
-     (char *thisdie AND char *enddie AND struct objfile *objfile));
+basicdieinfo PARAMS ((struct dieinfo *, char *));
 
 static void
-EXFUN(read_structure_scope,
-     (struct dieinfo *dip AND char *thisdie AND char *enddie));
+completedieinfo PARAMS ((struct dieinfo *));
 
-static struct type *
-EXFUN(decode_array_element_type, (char *scan AND char *end));
-
-static struct type *
-EXFUN(decode_subscr_data, (char *scan AND char *end));
+static void
+dwarf_psymtab_to_symtab PARAMS ((struct partial_symtab *));
 
 static void
-EXFUN(read_array_type, (struct dieinfo *dip));
+psymtab_to_symtab_1 PARAMS ((struct partial_symtab *));
+
+static struct symtab *
+read_ofile_symtab PARAMS ((struct partial_symtab *));
 
 static void
-EXFUN(read_subroutine_type,
-     (struct dieinfo *dip AND char *thisdie AND char *enddie));
+process_dies PARAMS ((char *, char *, struct objfile *));
 
 static void
-EXFUN(read_enumeration,
-     (struct dieinfo *dip AND char *thisdie AND char *enddie));
+read_structure_scope PARAMS ((struct dieinfo *, char *, char *,
+                             struct objfile *));
 
 static struct type *
-EXFUN(struct_type,
-      (struct dieinfo *dip AND char *thisdie AND char *enddie));
+decode_array_element_type PARAMS ((char *, char *));
 
 static struct type *
-EXFUN(enum_type, (struct dieinfo *dip));
+decode_subscr_data PARAMS ((char *, char *));
 
 static void
-EXFUN(start_symtab, (void));
+dwarf_read_array_type PARAMS ((struct dieinfo *));
 
 static void
-EXFUN(end_symtab,
-      (char *filename AND long language AND struct objfile *objfile));
-
-static int
-EXFUN(scopecount, (struct scopenode *node));
+read_tag_pointer_type PARAMS ((struct dieinfo *dip));
 
 static void
-EXFUN(openscope,
-      (struct symbol *namesym AND CORE_ADDR lowpc AND CORE_ADDR highpc));
+read_subroutine_type PARAMS ((struct dieinfo *, char *, char *));
 
 static void
-EXFUN(freescope, (struct scopenode *node));
+read_enumeration PARAMS ((struct dieinfo *, char *, char *, struct objfile *));
 
-static struct block *
-EXFUN(buildblock, (struct pending_symbol *syms));
-
-static void
-EXFUN(closescope, (void));
+static struct type *
+struct_type PARAMS ((struct dieinfo *, char *, char *, struct objfile *));
 
-static void
-EXFUN(record_line, (int line AND CORE_ADDR pc));
+static struct type *
+enum_type PARAMS ((struct dieinfo *, struct objfile *));
 
 static void
-EXFUN(decode_line_numbers, (char *linetable));
+decode_line_numbers PARAMS ((char *));
 
 static struct type *
-EXFUN(decode_die_type, (struct dieinfo *dip));
+decode_die_type PARAMS ((struct dieinfo *));
 
 static struct type *
-EXFUN(decode_mod_fund_type, (char *typedata));
+decode_mod_fund_type PARAMS ((char *));
 
 static struct type *
-EXFUN(decode_mod_u_d_type, (char *typedata));
+decode_mod_u_d_type PARAMS ((char *));
 
 static struct type *
-EXFUN(decode_modified_type,
-      (unsigned char *modifiers AND unsigned short modcount AND int mtype));
+decode_modified_type PARAMS ((unsigned char *, unsigned int, int));
 
 static struct type *
-EXFUN(decode_fund_type, (unsigned short fundtype));
+decode_fund_type PARAMS ((unsigned int));
 
 static char *
-EXFUN(create_name, (char *name AND struct obstack *obstackp));
-
-static void
-EXFUN(add_symbol_to_list,
-      (struct symbol *symbol AND struct pending_symbol **listhead));
-
-static struct block **
-EXFUN(gatherblocks, (struct block **dest AND struct scopenode *node));
-
-static struct blockvector *
-EXFUN(make_blockvector, (void));
+create_name PARAMS ((char *, struct obstack *));
 
 static struct type *
-EXFUN(lookup_utype, (DIEREF dieref));
+lookup_utype PARAMS ((DIEREF));
 
 static struct type *
-EXFUN(alloc_utype, (DIEREF dieref AND struct type *usetype));
+alloc_utype PARAMS ((DIEREF, struct type *));
 
 static struct symbol *
-EXFUN(new_symbol, (struct dieinfo *dip));
+new_symbol PARAMS ((struct dieinfo *, struct objfile *));
 
 static int
-EXFUN(locval, (char *loc));
+locval PARAMS ((char *));
 
 static void
-EXFUN(record_misc_function, (char *name AND CORE_ADDR address AND
-                            enum misc_function_type));
-
-static int
-EXFUN(compare_psymbols,
-      (struct partial_symbol *s1 AND struct partial_symbol *s2));
-
+record_minimal_symbol PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type,
+                              struct objfile *));
 
 /*
 
@@ -493,18 +409,17 @@ RETURNS
  */
 
 void
-DEFUN(dwarf_build_psymtabs,
-      (desc, filename, addr, mainline, dbfoff, dbsize, lnoffset, lnsize,
-       objfile),
-      int desc AND
-      char *filename AND
-      CORE_ADDR addr AND
-      int mainline AND
-      unsigned int dbfoff AND
-      unsigned int dbsize AND
-      unsigned int lnoffset AND
-      unsigned int lnsize AND
-      struct objfile *objfile)
+dwarf_build_psymtabs (desc, filename, addr, mainline, dbfoff, dbsize,
+                     lnoffset, lnsize, objfile)
+     int desc;
+     char *filename;
+     CORE_ADDR addr;
+     int mainline;
+     unsigned int dbfoff;
+     unsigned int dbsize;
+     unsigned int lnoffset;
+     unsigned int lnsize;
+     struct objfile *objfile;
 {
   struct cleanup *back_to;
   
@@ -522,16 +437,28 @@ DEFUN(dwarf_build_psymtabs,
      Since we have no idea how many DIES we are looking at, we just guess
      some arbitrary value. */
   
-  if (mainline || global_psymbols.size == 0 || static_psymbols.size == 0)
+  if (mainline || objfile->global_psymbols.size == 0 || objfile->static_psymbols.size == 0)
     {
-      init_psymbol_list (1024);
+      init_psymbol_list (objfile, 1024);
     }
   
+  /* From this point on, we don't need to pass mainline around, so zap
+     baseaddr to zero if we don't need relocation. */
+
+  if (mainline)
+    {
+      baseaddr = 0;
+    }
+  else
+    {
+      baseaddr = addr;
+    }
+
   /* Follow the compilation unit sibling chain, building a partial symbol
      table entry for each one.  Save enough information about each compilation
      unit to locate the full DWARF information later. */
   
-  scan_compilation_units (filename, addr, dbbase, dbbase + dbsize,
+  scan_compilation_units (filename, dbbase, dbbase + dbsize,
                          dbfoff, lnoffset, objfile);
   
   do_cleanups (back_to);
@@ -542,28 +469,32 @@ DEFUN(dwarf_build_psymtabs,
 
 LOCAL FUNCTION
 
-       record_misc_function -- add entry to miscellaneous function vector
+       record_minimal_symbol -- add entry to gdb's minimal symbol table
 
 SYNOPSIS
 
-       static void record_misc_function (char *name, CORE_ADDR address,
-                                         enum misc_function_type mf_type)
+       static void record_minimal_symbol (char *name, CORE_ADDR address,
+                                         enum minimal_symbol_type ms_type,
+                                         struct objfile *objfile)
 
 DESCRIPTION
 
        Given a pointer to the name of a symbol that should be added to the
-       miscellaneous function vector, and the address associated with that
+       minimal symbol table, and the address associated with that
        symbol, records this information for later use in building the
-       miscellaneous function vector.
+       minimal symbol table.
 
  */
 
 static void
-DEFUN(record_misc_function, (name, address, mf_type),
-      char *name AND CORE_ADDR address AND enum misc_function_type mf_type)
+record_minimal_symbol (name, address, ms_type, objfile)
+     char *name;
+     CORE_ADDR address;
+     enum minimal_symbol_type ms_type;
+     struct objfile *objfile;
 {
-  prim_record_misc_function (obsavestring (name, strlen (name)), address,
-                            mf_type);
+  name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
+  prim_record_minimal_symbol (name, address, ms_type);
 }
 
 /*
@@ -594,26 +525,6 @@ NOTES
        information for the DIE where the problem was noticed.
 */
 
-#ifdef __STDC__
-static void
-DEFUN(dwarfwarn, (fmt), char *fmt DOTS)
-{
-  va_list ap;
-  
-  va_start (ap, fmt);
-  warning_setup ();
-  fprintf (stderr, "DWARF warning (ref 0x%x): ", curdie -> dieref);
-  if (curdie -> at_name)
-    {
-      fprintf (stderr, "'%s': ", curdie -> at_name);
-    }
-  vfprintf (stderr, fmt, ap);
-  fprintf (stderr, "\n");
-  fflush (stderr);
-  va_end (ap);
-}
-#else
-
 static void
 dwarfwarn (va_alist)
      va_dcl
@@ -634,53 +545,6 @@ dwarfwarn (va_alist)
   fflush (stderr);
   va_end (ap);
 }
-#endif
-/*
-
-LOCAL FUNCTION
-
-       compare_psymbols -- compare two partial symbols by name
-
-DESCRIPTION
-
-       Given pointer to two partial symbol table entries, compare
-       them by name and return -N, 0, or +N (ala strcmp).  Typically
-       used by sorting routines like qsort().
-
-NOTES
-
-       This is a copy from dbxread.c.  It should be moved to a generic
-       gdb file and made available for all psymtab builders (FIXME).
-
-       Does direct compare of first two characters before punting
-       and passing to strcmp for longer compares.  Note that the
-       original version had a bug whereby two null strings or two
-       identically named one character strings would return the
-       comparison of memory following the null byte.
-
- */
-
-static int
-DEFUN(compare_psymbols, (s1, s2), 
-      struct partial_symbol *s1 AND
-      struct partial_symbol *s2)
-{
-  register char *st1 = SYMBOL_NAME (s1);
-  register char *st2 = SYMBOL_NAME (s2);
-
-  if ((st1[0] - st2[0]) || !st1[0])
-    {
-      return (st1[0] - st2[0]);
-    }
-  else if ((st1[1] - st2[1]) || !st1[1])
-    {
-      return (st1[1] - st2[1]);
-    }
-  else
-    {
-      return (strcmp (st1 + 2, st2 + 2));
-    }
-}
 
 /*
 
@@ -701,15 +565,23 @@ DESCRIPTION
  */
 
 static void
-DEFUN(read_lexical_block_scope, (dip, thisdie, enddie, objfile),
-     struct dieinfo *dip AND
-     char *thisdie AND
-     char *enddie AND
-     struct objfile *objfile)
+read_lexical_block_scope (dip, thisdie, enddie, objfile)
+     struct dieinfo *dip;
+     char *thisdie;
+     char *enddie;
+     struct objfile *objfile;
 {
-  openscope (NULL, dip -> at_low_pc, dip -> at_high_pc);
+  register struct context_stack *new;
+
+  (void) push_context (0, dip -> at_low_pc);
   process_dies (thisdie + dip -> dielength, enddie, objfile);
-  closescope ();
+  new = pop_context ();
+  if (local_symbols != NULL)
+    {
+      finish_block (0, &local_symbols, new -> old_blocks, new -> start_addr,
+                   dip -> at_high_pc, objfile);
+    }
+  local_symbols = new -> locals;
 }
 
 /*
@@ -732,7 +604,8 @@ DESCRIPTION
  */
 
 static struct type *
-DEFUN(lookup_utype, (dieref), DIEREF dieref)
+lookup_utype (dieref)
+     DIEREF dieref;
 {
   struct type *type = NULL;
   int utypeidx;
@@ -772,9 +645,9 @@ DESCRIPTION
  */
 
 static struct type *
-DEFUN(alloc_utype, (dieref, utypep),
-     DIEREF dieref AND
-     struct type *utypep)
+alloc_utype (dieref, utypep)
+     DIEREF dieref;
+     struct type *utypep;
 {
   struct type **typep;
   int utypeidx;
@@ -783,7 +656,7 @@ DEFUN(alloc_utype, (dieref, utypep),
   typep = utypes + utypeidx;
   if ((utypeidx < 0) || (utypeidx >= numutypes))
     {
-      utypep = builtin_type_int;
+      utypep = lookup_fundamental_type (current_objfile, FT_INTEGER);
       dwarfwarn ("reference to DIE (0x%x) outside compilation unit", dieref);
     }
   else if (*typep != NULL)
@@ -796,8 +669,10 @@ DEFUN(alloc_utype, (dieref, utypep),
       if (utypep == NULL)
        {
          utypep = (struct type *)
-           obstack_alloc (symbol_obstack, sizeof (struct type));
+           obstack_alloc (&current_objfile -> type_obstack,
+                          sizeof (struct type));
          (void) memset (utypep, 0, sizeof (struct type));
+         TYPE_OBJFILE (utypep) = current_objfile;
        }
       *typep = utypep;
     }
@@ -822,7 +697,8 @@ DESCRIPTION
  */
 
 static struct type *
-DEFUN(decode_die_type, (dip), struct dieinfo *dip)
+decode_die_type (dip)
+     struct dieinfo *dip;
 {
   struct type *type = NULL;
   
@@ -847,7 +723,7 @@ DEFUN(decode_die_type, (dip), struct dieinfo *dip)
     }
   else
     {
-      type = builtin_type_int;
+      type = lookup_fundamental_type (current_objfile, FT_INTEGER);
     }
   return (type);
 }
@@ -861,21 +737,23 @@ LOCAL FUNCTION
 SYNOPSIS
 
        static struct type *struct_type (struct dieinfo *dip, char *thisdie,
-           char *enddie)
+           char *enddie, struct objfile *objfile)
 
 DESCRIPTION
 
        Given pointer to a die information structure for a die which
-       defines a union or structure, and pointers to the raw die data
-       that define the range of dies which define the members, compute
-       and return the user defined type for the structure or union.
+       defines a union or structure (and MUST define one or the other),
+       and pointers to the raw die data that define the range of dies which
+       define the members, compute and return the user defined type for the
+       structure or union.
  */
 
 static struct type *
-DEFUN(struct_type, (dip, thisdie, enddie),
-     struct dieinfo *dip AND
-     char *thisdie AND
-     char *enddie)
+struct_type (dip, thisdie, enddie, objfile)
+     struct dieinfo *dip;
+     char *thisdie;
+     char *enddie;
+     struct objfile *objfile;
 {
   struct type *type;
   struct nextfield {
@@ -887,49 +765,46 @@ DEFUN(struct_type, (dip, thisdie, enddie),
   int nfields = 0;
   int n;
   char *tpart1;
-  char *tpart2;
-  char *tpart3;
   struct dieinfo mbr;
+  char *nextdie;
   
   if ((type = lookup_utype (dip -> dieref)) == NULL)
     {
+      /* No forward references created an empty type, so install one now */
       type = alloc_utype (dip -> dieref, NULL);
     }
+  INIT_CPLUS_SPECIFIC(type);
   switch (dip -> dietag)
     {
-    case TAG_structure_type:
-      TYPE_CODE (type) = TYPE_CODE_STRUCT;
-      TYPE_CPLUS_SPECIFIC (type)
-       = (struct cplus_struct_type *) obstack_alloc (symbol_obstack, sizeof (struct cplus_struct_type));
-      bzero (TYPE_CPLUS_SPECIFIC (type), sizeof (struct cplus_struct_type));
-      tpart1 = "struct ";
-      break;
-    case TAG_union_type:
-      TYPE_CODE (type) = TYPE_CODE_UNION;
-      tpart1 = "union ";
-      break;
-    default:
-      tpart1 = "";
-      SQUAWK (("missing structure or union tag"));
-      TYPE_CODE (type) = TYPE_CODE_UNDEF;
-      break;
-    }
-  if (dip -> at_name == NULL)
-    {
-      tpart2 = "{...}";
+      case TAG_structure_type:
+        TYPE_CODE (type) = TYPE_CODE_STRUCT;
+       tpart1 = "struct";
+       break;
+      case TAG_union_type:
+       TYPE_CODE (type) = TYPE_CODE_UNION;
+       tpart1 = "union";
+       break;
+      default:
+       /* Should never happen */
+       TYPE_CODE (type) = TYPE_CODE_UNDEF;
+       tpart1 = "???";
+       SQUAWK (("missing structure or union tag"));
+       break;
     }
-  else
+  /* Some compilers try to be helpful by inventing "fake" names for
+     anonymous enums, structures, and unions, like "~0fake" or ".0fake".
+     Thanks, but no thanks... */
+  if (dip -> at_name != NULL
+      && *dip -> at_name != '~'
+      && *dip -> at_name != '.')
     {
-      tpart2 = dip -> at_name;
+      TYPE_NAME (type) = obconcat (&current_objfile -> type_obstack,
+                                  tpart1, " ", dip -> at_name);
     }
-  if (dip -> at_byte_size == 0)
+  if (dip -> at_byte_size != 0)
     {
-      tpart3 = " <opaque>";
-    } else {
       TYPE_LENGTH (type) = dip -> at_byte_size;
-      tpart3 = "";
     }
-  TYPE_NAME (type) = concat (tpart1, tpart2, tpart3, NULL);
   thisdie += dip -> dielength;
   while (thisdie < enddie)
     {
@@ -939,6 +814,14 @@ DEFUN(struct_type, (dip, thisdie, enddie),
        {
          break;
        }
+      else if (mbr.at_sibling != 0)
+       {
+         nextdie = dbbase + mbr.at_sibling - dbroff;
+       }
+      else
+       {
+         nextdie = thisdie + mbr.dielength;
+       }
       switch (mbr.dietag)
        {
        case TAG_member:
@@ -954,20 +837,32 @@ DEFUN(struct_type, (dip, thisdie, enddie),
          nfields++;
          break;
        default:
-         SQUAWK (("bad member of '%s'", TYPE_NAME (type)));
+         process_dies (thisdie, nextdie, objfile);
          break;
        }
-      thisdie += mbr.dielength;
+      thisdie = nextdie;
+    }
+  /* Now create the vector of fields, and record how big it is.  We may
+     not even have any fields, if this DIE was generated due to a reference
+     to an anonymous structure or union.  In this case, TYPE_FLAG_STUB is
+     set, which clues gdb in to the fact that it needs to search elsewhere
+     for the full structure definition. */
+  if (nfields == 0)
+    {
+      TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
     }
-  /* Now create the vector of fields, and record how big it is.  */
-  TYPE_NFIELDS (type) = nfields;
-  TYPE_FIELDS (type) = (struct field *)
-    obstack_alloc (symbol_obstack, sizeof (struct field) * nfields);
-  /* Copy the saved-up fields into the field vector.  */
-  for (n = nfields; list; list = list -> next)
+  else
     {
-      TYPE_FIELD (type, --n) = list -> field;
-    }  
+      TYPE_NFIELDS (type) = nfields;
+      TYPE_FIELDS (type) = (struct field *)
+       obstack_alloc (&current_objfile -> type_obstack,
+                      sizeof (struct field) * nfields);
+      /* Copy the saved-up fields into the field vector.  */
+      for (n = nfields; list; list = list -> next)
+       {
+         TYPE_FIELD (type, --n) = list -> field;
+       }       
+    }
   return (type);
 }
 
@@ -980,7 +875,7 @@ LOCAL FUNCTION
 SYNOPSIS
 
        static void read_structure_scope (struct dieinfo *dip,
-               char *thisdie, char *enddie)
+               char *thisdie, char *enddie, struct objfile *objfile)
 
 DESCRIPTION
 
@@ -992,23 +887,36 @@ DESCRIPTION
 NOTES
 
        Note that we need to call struct_type regardless of whether or not
-       we have a symbol, since we might have a structure or union without
-       a tag name (thus no symbol for the tagname).
+       the DIE has an at_name attribute, since it might be an anonymous
+       structure or union.  This gets the type entered into our set of
+       user defined types.
+
+       However, if the structure is incomplete (an opaque struct/union)
+       then suppress creating a symbol table entry for it since gdb only
+       wants to find the one with the complete definition.  Note that if
+       it is complete, we just call new_symbol, which does it's own
+       checking about whether the struct/union is anonymous or not (and
+       suppresses creating a symbol table entry itself).
+       
  */
 
 static void
-DEFUN(read_structure_scope, (dip, thisdie, enddie),
-     struct dieinfo *dip AND
-     char *thisdie AND
-     char *enddie)
+read_structure_scope (dip, thisdie, enddie, objfile)
+     struct dieinfo *dip;
+     char *thisdie;
+     char *enddie;
+     struct objfile *objfile;
 {
   struct type *type;
   struct symbol *sym;
   
-  type = struct_type (dip, thisdie, enddie);
-  if ((sym = new_symbol (dip)) != NULL)
+  type = struct_type (dip, thisdie, enddie, objfile);
+  if (!(TYPE_FLAGS (type) & TYPE_FLAG_STUB))
     {
-      SYMBOL_TYPE (sym) = type;
+      if ((sym = new_symbol (dip, objfile)) != NULL)
+       {
+         SYMBOL_TYPE (sym) = type;
+       }
     }
 }
 
@@ -1032,7 +940,9 @@ DESCRIPTION
  */
 
 static struct type *
-DEFUN(decode_array_element_type, (scan, end), char *scan AND char *end)
+decode_array_element_type (scan, end)
+     char *scan;
+     char *end;
 {
   struct type *typep;
   short attribute;
@@ -1062,7 +972,7 @@ DEFUN(decode_array_element_type, (scan, end), char *scan AND char *end)
       break;
     default:
       SQUAWK (("bad array element type attribute 0x%x", attribute));
-      typep = builtin_type_int;
+      typep = lookup_fundamental_type (current_objfile, FT_INTEGER);
       break;
     }
   return (typep);
@@ -1101,7 +1011,9 @@ BUGS
  */
 
 static struct type *
-DEFUN(decode_subscr_data, (scan, end), char *scan AND char *end)
+decode_subscr_data (scan, end)
+     char *scan;
+     char *end;
 {
   struct type *typep = NULL;
   struct type *nexttype;
@@ -1135,8 +1047,10 @@ DEFUN(decode_subscr_data, (scan, end), char *scan AND char *end)
          if (nexttype != NULL)
            {
              typep = (struct type *)
-               obstack_alloc (symbol_obstack, sizeof (struct type));
+               obstack_alloc (&current_objfile -> type_obstack,
+                              sizeof (struct type));
              (void) memset (typep, 0, sizeof (struct type));
+             TYPE_OBJFILE (typep) = current_objfile;
              TYPE_CODE (typep) = TYPE_CODE_ARRAY;
              TYPE_LENGTH (typep) = TYPE_LENGTH (nexttype);
              TYPE_LENGTH (typep) *= lowbound + highbound + 1;
@@ -1164,11 +1078,11 @@ DEFUN(decode_subscr_data, (scan, end), char *scan AND char *end)
 
 LOCAL FUNCTION
 
-       read_array_type -- read TAG_array_type DIE
+       dwarf_read_array_type -- read TAG_array_type DIE
 
 SYNOPSIS
 
-       static void read_array_type (struct dieinfo *dip)
+       static void dwarf_read_array_type (struct dieinfo *dip)
 
 DESCRIPTION
 
@@ -1177,9 +1091,11 @@ DESCRIPTION
  */
 
 static void
-DEFUN(read_array_type, (dip), struct dieinfo *dip)
+dwarf_read_array_type (dip)
+     struct dieinfo *dip;
 {
   struct type *type;
+  struct type *utype;
   char *sub;
   char *subend;
   short temp;
@@ -1197,20 +1113,79 @@ DEFUN(read_array_type, (dip), struct dieinfo *dip)
       type = decode_subscr_data (sub, subend);
       if (type == NULL)
        {
-         type = alloc_utype (dip -> dieref, NULL);
-         TYPE_CODE (type) = TYPE_CODE_ARRAY;
-         TYPE_TARGET_TYPE (type) = builtin_type_int;
-         TYPE_LENGTH (type) = 1 * TYPE_LENGTH (TYPE_TARGET_TYPE (type));
+         if ((utype = lookup_utype (dip -> dieref)) == NULL)
+           {
+             utype = alloc_utype (dip -> dieref, NULL);
+           }
+         TYPE_CODE (utype) = TYPE_CODE_ARRAY;
+         TYPE_TARGET_TYPE (utype) = 
+           lookup_fundamental_type (current_objfile, FT_INTEGER);
+         TYPE_LENGTH (utype) = 1 * TYPE_LENGTH (TYPE_TARGET_TYPE (utype));
        }
       else
        {
-         type = alloc_utype (dip -> dieref, type);
+         if ((utype = lookup_utype (dip -> dieref)) == NULL)
+           {
+             (void) alloc_utype (dip -> dieref, type);
+           }
+         else
+           {
+             TYPE_CODE (utype) = TYPE_CODE_ARRAY;
+             TYPE_LENGTH (utype) = TYPE_LENGTH (type);
+             TYPE_TARGET_TYPE (utype) = TYPE_TARGET_TYPE (type);
+           }
        }
     }
 }
 
 /*
 
+LOCAL FUNCTION
+
+       read_tag_pointer_type -- read TAG_pointer_type DIE
+
+SYNOPSIS
+
+       static void read_tag_pointer_type (struct dieinfo *dip)
+
+DESCRIPTION
+
+       Extract all information from a TAG_pointer_type DIE and add to
+       the user defined type vector.
+ */
+
+static void
+read_tag_pointer_type (dip)
+     struct dieinfo *dip;
+{
+  struct type *type;
+  struct type *utype;
+  char *sub;
+  char *subend;
+  short temp;
+  
+  type = decode_die_type (dip);
+  if ((utype = lookup_utype (dip -> dieref)) == NULL)
+    {
+      utype = lookup_pointer_type (type);
+      (void) alloc_utype (dip -> dieref, utype);
+    }
+  else
+    {
+      TYPE_TARGET_TYPE (utype) = type;
+      TYPE_POINTER_TYPE (type) = utype;
+
+      /* We assume the machine has only one representation for pointers!  */
+      /* FIXME:  This confuses host<->target data representations, and is a
+        poor assumption besides. */
+      
+      TYPE_LENGTH (utype) = sizeof (char *);
+      TYPE_CODE (utype) = TYPE_CODE_PTR;
+    }
+}
+
+/*
+
 LOCAL FUNCTION
 
        read_subroutine_type -- process TAG_subroutine_type dies
@@ -1237,16 +1212,37 @@ NOTES
  */
 
 static void
-DEFUN(read_subroutine_type, (dip, thisdie, enddie),
-     struct dieinfo *dip AND
-     char *thisdie AND
-     char *enddie)
+read_subroutine_type (dip, thisdie, enddie)
+     struct dieinfo *dip;
+     char *thisdie;
+     char *enddie;
 {
-  struct type *type;
+  struct type *type;           /* Type that this function returns */
+  struct type *ftype;          /* Function that returns above type */
   
+  /* Decode the type that this subroutine returns */
+
   type = decode_die_type (dip);
-  type = lookup_function_type (type);
-  type = alloc_utype (dip -> dieref, type);
+
+  /* Check to see if we already have a partially constructed user
+     defined type for this DIE, from a forward reference. */
+
+  if ((ftype = lookup_utype (dip -> dieref)) == NULL)
+    {
+      /* This is the first reference to one of these types.  Make
+        a new one and place it in the user defined types. */
+      ftype = lookup_function_type (type);
+      (void) alloc_utype (dip -> dieref, ftype);
+    }
+  else
+    {
+      /* We have an existing partially constructed type, so bash it
+        into the correct type. */
+      TYPE_TARGET_TYPE (ftype) = type;
+      TYPE_FUNCTION_TYPE (type) = ftype;
+      TYPE_LENGTH (ftype) = 1;
+      TYPE_CODE (ftype) = TYPE_CODE_FUNC;
+    }
 }
 
 /*
@@ -1258,7 +1254,7 @@ LOCAL FUNCTION
 SYNOPSIS
 
        static void read_enumeration (struct dieinfo *dip, char *thisdie,
-               char *enddie)
+               char *enddie, struct objfile *objfile)
 
 DESCRIPTION
 
@@ -1273,16 +1269,17 @@ NOTES
  */
 
 static void
-DEFUN(read_enumeration, (dip, thisdie, enddie),
-     struct dieinfo *dip AND
-     char *thisdie AND
-     char *enddie)
+read_enumeration (dip, thisdie, enddie, objfile)
+     struct dieinfo *dip;
+     char *thisdie;
+     char *enddie;
+     struct objfile *objfile;
 {
   struct type *type;
   struct symbol *sym;
   
-  type = enum_type (dip);
-  if ((sym = new_symbol (dip)) != NULL)
+  type = enum_type (dip, objfile);
+  if ((sym = new_symbol (dip, objfile)) != NULL)
     {
       SYMBOL_TYPE (sym) = type;
     }
@@ -1296,17 +1293,33 @@ LOCAL FUNCTION
 
 SYNOPSIS
 
-       static type *enum_type (struct dieinfo *dip)
+       static type *enum_type (struct dieinfo *dip, struct objfile *objfile)
 
 DESCRIPTION
 
        Given a pointer to a die information structure for the die which
        starts an enumeration, process all the dies that define the members
        of the enumeration and return a type pointer for the enumeration.
+
+       At the same time, for each member of the enumeration, create a
+       symbol for it with namespace VAR_NAMESPACE and class LOC_CONST,
+       and give it the type of the enumeration itself.
+
+NOTES
+
+       Note that the DWARF specification explicitly mandates that enum
+       constants occur in reverse order from the source program order,
+       for "consistency" and because this ordering is easier for many
+       compilers to generate. (Draft 6, sec 3.8.5, Enumeration type
+       Entries).  Because gdb wants to see the enum members in program
+       source order, we have to ensure that the order gets reversed while
+       we are processing them.
  */
 
 static struct type *
-DEFUN(enum_type, (dip), struct dieinfo *dip)
+enum_type (dip, objfile)
+     struct dieinfo *dip;
+     struct objfile *objfile;
 {
   struct type *type;
   struct nextfield {
@@ -1317,40 +1330,46 @@ DEFUN(enum_type, (dip), struct dieinfo *dip)
   struct nextfield *new;
   int nfields = 0;
   int n;
-  char *tpart1;
-  char *tpart2;
-  char *tpart3;
   char *scan;
   char *listend;
-  long temp;
+  long ltemp;
+  short stemp;
+  struct symbol *sym;
   
   if ((type = lookup_utype (dip -> dieref)) == NULL)
     {
+      /* No forward references created an empty type, so install one now */
       type = alloc_utype (dip -> dieref, NULL);
     }
   TYPE_CODE (type) = TYPE_CODE_ENUM;
-  tpart1 = "enum ";
-  if (dip -> at_name == NULL)
-    {
-      tpart2 = "{...}";
-    } else {
-      tpart2 = dip -> at_name;
-    }
-  if (dip -> at_byte_size == 0)
+  /* Some compilers try to be helpful by inventing "fake" names for
+     anonymous enums, structures, and unions, like "~0fake" or ".0fake".
+     Thanks, but no thanks... */
+  if (dip -> at_name != NULL
+      && *dip -> at_name != '~'
+      && *dip -> at_name != '.')
     {
-      tpart3 = " <opaque>";
+      TYPE_NAME (type) = obconcat (&current_objfile -> type_obstack, "enum",
+                                  " ", dip -> at_name);
     }
-  else
+  if (dip -> at_byte_size != 0)
     {
       TYPE_LENGTH (type) = dip -> at_byte_size;
-      tpart3 = "";
     }
-  TYPE_NAME (type) = concat (tpart1, tpart2, tpart3, NULL);
   if ((scan = dip -> at_element_list) != NULL)
     {
-      (void) memcpy (&temp, scan, sizeof (temp));
-      listend = scan + temp + sizeof (temp);
-      scan += sizeof (temp);
+      if (dip -> short_element_list)
+       {
+         (void) memcpy (&stemp, scan, sizeof (stemp));
+         listend = scan + stemp + sizeof (stemp);
+         scan += sizeof (stemp);
+       }
+      else
+       {
+         (void) memcpy (&ltemp, scan, sizeof (ltemp));
+         listend = scan + ltemp + sizeof (ltemp);
+         scan += sizeof (ltemp);
+       }
       while (scan < listend)
        {
          new = (struct nextfield *) alloca (sizeof (struct nextfield));
@@ -1363,17 +1382,34 @@ DEFUN(enum_type, (dip), struct dieinfo *dip)
          list -> field.name = savestring (scan, strlen (scan));
          scan += strlen (scan) + 1;
          nfields++;
+         /* Handcraft a new symbol for this enum member. */
+         sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
+                                                sizeof (struct symbol));
+         (void) memset (sym, 0, sizeof (struct symbol));
+         SYMBOL_NAME (sym) = create_name (list -> field.name, &objfile->symbol_obstack);
+         SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+         SYMBOL_CLASS (sym) = LOC_CONST;
+         SYMBOL_TYPE (sym) = type;
+         SYMBOL_VALUE (sym) = list -> field.bitpos;
+         add_symbol_to_list (sym, list_in_scope);
+       }
+      /* Now create the vector of fields, and record how big it is. This is
+        where we reverse the order, by pulling the members of the list in
+        reverse order from how they were inserted.  If we have no fields
+        (this is apparently possible in C++) then skip building a field
+        vector. */
+      if (nfields > 0)
+       {
+         TYPE_NFIELDS (type) = nfields;
+         TYPE_FIELDS (type) = (struct field *)
+           obstack_alloc (&objfile->symbol_obstack, sizeof (struct field) * nfields);
+         /* Copy the saved-up fields into the field vector.  */
+         for (n = 0; (n < nfields) && (list != NULL); list = list -> next)
+           {
+             TYPE_FIELD (type, n++) = list -> field;
+           }   
        }
     }
-  /* Now create the vector of fields, and record how big it is.  */
-  TYPE_NFIELDS (type) = nfields;
-  TYPE_FIELDS (type) = (struct field *)
-    obstack_alloc (symbol_obstack, sizeof (struct field) * nfields);
-  /* Copy the saved-up fields into the field vector.  */
-  for (n = nfields; list; list = list -> next)
-    {
-      TYPE_FIELD (type, --n) = list -> field;
-    }  
   return (type);
 }
 
@@ -1399,28 +1435,33 @@ DESCRIPTION
  */
 
 static void
-DEFUN(read_func_scope, (dip, thisdie, enddie, objfile),
-     struct dieinfo *dip AND
-     char *thisdie AND
-     char *enddie AND
-     struct objfile *objfile)
+read_func_scope (dip, thisdie, enddie, objfile)
+     struct dieinfo *dip;
+     char *thisdie;
+     char *enddie;
+     struct objfile *objfile;
 {
-  struct symbol *sym;
+  register struct context_stack *new;
   
   if (entry_point >= dip -> at_low_pc && entry_point < dip -> at_high_pc)
     {
       entry_scope_lowpc = dip -> at_low_pc;
       entry_scope_highpc = dip -> at_high_pc;
     }
-  if (strcmp (dip -> at_name, "main") == 0)    /* FIXME: hardwired name */
+  if (STREQ (dip -> at_name, "main"))  /* FIXME: hardwired name */
     {
       main_scope_lowpc = dip -> at_low_pc;
       main_scope_highpc = dip -> at_high_pc;
     }
-  sym = new_symbol (dip);
-  openscope (sym, dip -> at_low_pc, dip -> at_high_pc);
+  new = push_context (0, dip -> at_low_pc);
+  new -> name = new_symbol (dip, objfile);
+  list_in_scope = &local_symbols;
   process_dies (thisdie + dip -> dielength, enddie, objfile);
-  closescope ();
+  new = pop_context ();
+  /* Make a block for the local symbols within.  */
+  finish_block (new -> name, &local_symbols, new -> old_blocks,
+               new -> start_addr, dip -> at_high_pc, objfile);
+  list_in_scope = &file_symbols;
 }
 
 /*
@@ -1446,29 +1487,46 @@ DESCRIPTION
  */
 
 static void
-DEFUN(read_file_scope, (dip, thisdie, enddie, objfile),
-     struct dieinfo *dip AND
-     char *thisdie AND
-     char *enddie AND
-     struct objfile *objfile)
+read_file_scope (dip, thisdie, enddie, objfile)
+     struct dieinfo *dip;
+     char *thisdie;
+     char *enddie;
+     struct objfile *objfile;
 {
   struct cleanup *back_to;
+  struct symtab *symtab;
   
   if (entry_point >= dip -> at_low_pc && entry_point < dip -> at_high_pc)
     {
       startup_file_start = dip -> at_low_pc;
       startup_file_end = dip -> at_high_pc;
     }
+  if (dip -> at_producer != NULL)
+    {
+      processing_gcc_compilation =
+       STREQN (dip -> at_producer, GCC_PRODUCER, strlen (GCC_PRODUCER));
+    }
   numutypes = (enddie - thisdie) / 4;
   utypes = (struct type **) xmalloc (numutypes * sizeof (struct type *));
   back_to = make_cleanup (free, utypes);
   (void) memset (utypes, 0, numutypes * sizeof (struct type *));
-  start_symtab ();
-  openscope (NULL, dip -> at_low_pc, dip -> at_high_pc);
+  start_symtab (dip -> at_name, NULL, dip -> at_low_pc);
   decode_line_numbers (lnbase);
   process_dies (thisdie + dip -> dielength, enddie, objfile);
-  closescope ();
-  end_symtab (dip -> at_name, dip -> at_language, objfile);
+  symtab = end_symtab (dip -> at_high_pc, 0, 0, objfile);
+  /* FIXME:  The following may need to be expanded for other languages */
+  switch (dip -> at_language)
+    {
+      case LANG_C89:
+      case LANG_C:
+       symtab -> language = language_c;
+       break;
+      case LANG_C_PLUS_PLUS:
+       symtab -> language = language_cplus;
+       break;
+      default:
+       ;
+    }
   do_cleanups (back_to);
   utypes = NULL;
   numutypes = 0;
@@ -1476,44 +1534,14 @@ DEFUN(read_file_scope, (dip, thisdie, enddie, objfile),
 
 /*
 
-LOCAL FUNCTION
-
-       start_symtab -- do initialization for starting new symbol table
-
-SYNOPSIS
-
-       static void start_symtab (void)
-
-DESCRIPTION
-
-       Called whenever we are starting to process dies for a new
-       compilation unit, to perform initializations.  Right now
-       the only thing we really have to do is initialize storage
-       space for the line number vector.
-
- */
-
-static void
-DEFUN_VOID (start_symtab)
-{
-  int nbytes;
-
-  line_vector_index = 0;
-  line_vector_length = 1000;
-  nbytes = sizeof (struct linetable);
-  nbytes += line_vector_length * sizeof (struct linetable_entry);
-  line_vector = (struct linetable *) xmalloc (nbytes);
-}
-
-/*
-
 LOCAL FUNCTION
 
        process_dies -- process a range of DWARF Information Entries
 
 SYNOPSIS
 
-       static void process_dies (char *thisdie, char *enddie)
+       static void process_dies (char *thisdie, char *enddie,
+                                 struct objfile *objfile)
 
 DESCRIPTION
 
@@ -1522,8 +1550,10 @@ DESCRIPTION
  */
 
 static void
-DEFUN(process_dies, (thisdie, enddie, objfile),
-      char *thisdie AND char *enddie AND struct objfile *objfile)
+process_dies (thisdie, enddie, objfile)
+     char *thisdie;
+     char *enddie;
+     struct objfile *objfile;
 {
   char *nextdie;
   struct dieinfo di;
@@ -1557,7 +1587,7 @@ DEFUN(process_dies, (thisdie, enddie, objfile),
              break;
            case TAG_global_subroutine:
            case TAG_subroutine:
-             if (!di.at_is_external_p)
+             if (di.has_at_low_pc)
                {
                  read_func_scope (&di, thisdie, nextdie, objfile);
                }
@@ -1567,19 +1597,22 @@ DEFUN(process_dies, (thisdie, enddie, objfile),
              break;
            case TAG_structure_type:
            case TAG_union_type:
-             read_structure_scope (&di, thisdie, nextdie);
+             read_structure_scope (&di, thisdie, nextdie, objfile);
              break;
            case TAG_enumeration_type:
-             read_enumeration (&di, thisdie, nextdie);
+             read_enumeration (&di, thisdie, nextdie, objfile);
              break;
            case TAG_subroutine_type:
              read_subroutine_type (&di, thisdie, nextdie);
              break;
            case TAG_array_type:
-             read_array_type (&di);
+             dwarf_read_array_type (&di);
+             break;
+           case TAG_pointer_type:
+             read_tag_pointer_type (&di);
              break;
            default:
-             (void) new_symbol (&di);
+             (void) new_symbol (&di, objfile);
              break;
            }
        }
@@ -1591,381 +1624,19 @@ DEFUN(process_dies, (thisdie, enddie, objfile),
 
 LOCAL FUNCTION
 
-       end_symtab -- finish processing for a compilation unit
+       decode_line_numbers -- decode a line number table fragment
 
 SYNOPSIS
 
-       static void end_symtab (char *filename, long language)
+       static void decode_line_numbers (char *tblscan, char *tblend,
+               long length, long base, long line, long pc)
 
 DESCRIPTION
 
-       Complete the symbol table entry for the current compilation
-       unit.  Make the struct symtab and put it on the list of all
-       such symtabs.
+       Translate the DWARF line number information to gdb form.
 
- */
-
-static void
-DEFUN(end_symtab, (filename, language, objfile),
-     char *filename AND long language AND struct objfile *objfile)
-{
-  struct symtab *symtab;
-  struct blockvector *blockvector;
-  int nbytes;
-  
-  /* Ignore a file that has no functions with real debugging info.  */
-  if (global_symbols == NULL && scopetree -> block == NULL)
-    {
-      free (line_vector);
-      line_vector = NULL;
-      line_vector_length = -1;
-      freescope (scopetree);
-      scope = scopetree = NULL;
-    }
-  
-  /* Create the blockvector that points to all the file's blocks.  */
-  
-  blockvector = make_blockvector ();
-  
-  /* Now create the symtab object for this source file.  */
-  
-  symtab = allocate_symtab (savestring (filename, strlen (filename)),
-                           objfile);
-  
-  symtab -> free_ptr = 0;
-  
-  /* Fill in its components.  */
-  symtab -> blockvector = blockvector;
-  symtab -> free_code = free_linetable;
-  
-  /* Save the line number information. */
-  
-  line_vector -> nitems = line_vector_index;
-  nbytes = sizeof (struct linetable);
-  if (line_vector_index > 1)
-    {
-      nbytes += (line_vector_index - 1) * sizeof (struct linetable_entry);
-    }
-  symtab -> linetable = (struct linetable *) xrealloc (line_vector, nbytes);
-  
-  /* FIXME:  The following may need to be expanded for other languages */
-  switch (language)
-    {
-      case LANG_C89:
-      case LANG_C:
-       symtab -> language = language_c;
-       break;
-      case LANG_C_PLUS_PLUS:
-       symtab -> language = language_cplus;
-       break;
-      default:
-       ;
-    }
-
-  /* Link the new symtab into the list of such.  */
-  symtab -> next = symtab_list;
-  symtab_list = symtab;
-  
-  /* Recursively free the scope tree */
-  freescope (scopetree);
-  scope = scopetree = NULL;
-  
-  /* Reinitialize for beginning of new file. */
-  line_vector = 0;
-  line_vector_length = -1;
-}
-
-/*
-
-LOCAL FUNCTION
-
-       scopecount -- count the number of enclosed scopes
-
-SYNOPSIS
-
-       static int scopecount (struct scopenode *node)
-
-DESCRIPTION
-
-       Given pointer to a node, compute the size of the subtree which is
-       rooted in this node, which also happens to be the number of scopes
-       to the subtree.
- */
-
-static int
-DEFUN(scopecount, (node), struct scopenode *node)
-{
-  int count = 0;
-  
-  if (node != NULL)
-    {
-      count += scopecount (node -> child);
-      count += scopecount (node -> sibling);
-      count++;
-    }
-  return (count);
-}
-
-/*
-
-LOCAL FUNCTION
-
-       openscope -- start a new lexical block scope
-
-SYNOPSIS
-
-       static void openscope (struct symbol *namesym, CORE_ADDR lowpc,
-               CORE_ADDR highpc)
-
-DESCRIPTION
-
-       Start a new scope by allocating a new scopenode, adding it as the
-       next child of the current scope (if any) or as the root of the
-       scope tree, and then making the new node the current scope node.
- */
-
-static void
-DEFUN(openscope, (namesym, lowpc, highpc),
-     struct symbol *namesym AND
-     CORE_ADDR lowpc AND
-     CORE_ADDR highpc)
-{
-  struct scopenode *new;
-  struct scopenode *child;
-  
-  new = (struct scopenode *) xmalloc (sizeof (*new));
-  (void) memset (new, 0, sizeof (*new));
-  new -> namesym = namesym;
-  new -> lowpc = lowpc;
-  new -> highpc = highpc;
-  if (scope == NULL)
-    {
-      scopetree = new;
-    }
-  else if ((child = scope -> child) == NULL)
-    {
-      scope -> child = new;
-      new -> parent = scope;
-    }
-  else
-    {
-    while (child -> sibling != NULL)
-      {
-       child = child -> sibling;
-      }
-    child -> sibling = new;
-    new -> parent = scope;
-  }
-  scope = new;
-}
-
-/*
-
-LOCAL FUNCTION
-
-       freescope -- free a scope tree rooted at the given node
-
-SYNOPSIS
-
-       static void freescope (struct scopenode *node)
-
-DESCRIPTION
-
-       Given a pointer to a node in the scope tree, free the subtree
-       rooted at that node.  First free all the children and sibling
-       nodes, and then the node itself.  Used primarily for cleaning
-       up after ourselves and returning memory to the system.
- */
-
-static void
-DEFUN(freescope, (node), struct scopenode *node)
-{
-  if (node != NULL)
-    {
-      freescope (node -> child);
-      freescope (node -> sibling);
-      free (node);
-    }
-}
-
-/*
-
-LOCAL FUNCTION
-
-       buildblock -- build a new block from pending symbols list
-
-SYNOPSIS
-
-       static struct block *buildblock (struct pending_symbol *syms)
-
-DESCRIPTION
-
-       Given a pointer to a list of symbols, build a new block and free
-       the symbol list structure.  Also check each symbol to see if it
-       is the special symbol that flags that this block was compiled by
-       gcc, and if so, mark the block appropriately.
- */
-
-static struct block *
-DEFUN(buildblock, (syms), struct pending_symbol *syms)
-{
-  struct pending_symbol *next, *next1;
-  int i;
-  struct block *newblock;
-  int nbytes;
-  
-  for (next = syms, i = 0 ; next ; next = next -> next, i++) {;}
-  
-  /* Allocate a new block */
-  
-  nbytes = sizeof (struct block);
-  if (i > 1)
-    {
-      nbytes += (i - 1) * sizeof (struct symbol *);
-    }
-  newblock = (struct block *) obstack_alloc (symbol_obstack, nbytes);
-  (void) memset (newblock, 0, nbytes);
-  
-  /* Copy the symbols into the block.  */
-  
-  BLOCK_NSYMS (newblock) = i;
-  for (next = syms ; next ; next = next -> next)
-    {
-      BLOCK_SYM (newblock, --i) = next -> symbol;
-      if (STREQ (GCC_COMPILED_FLAG_SYMBOL, SYMBOL_NAME (next -> symbol)) ||
-         STREQ (GCC2_COMPILED_FLAG_SYMBOL, SYMBOL_NAME (next -> symbol)))
-       {
-         BLOCK_GCC_COMPILED (newblock) = 1;
-       }
-    }    
-  
-  /* Now free the links of the list, and empty the list.  */
-  
-  for (next = syms ; next ; next = next1)
-    {
-      next1 = next -> next;
-      free (next);
-    }
-  
-  return (newblock);
-}
-
-/*
-
-LOCAL FUNCTION
-
-       closescope -- close a lexical block scope
-
-SYNOPSIS
-
-       static void closescope (void)
-
-DESCRIPTION
-
-       Close the current lexical block scope.  Closing the current scope
-       is as simple as moving the current scope pointer up to the parent
-       of the current scope pointer.  But we also take this opportunity
-       to build the block for the current scope first, since we now have
-       all of it's symbols.
- */
-
-static void
-DEFUN_VOID(closescope)
-{
-  struct scopenode *child;
-  
-  if (scope == NULL)
-    {
-      error ("DWARF parse error, too many close scopes");
-    }
-  else
-    {
-      if (scope -> parent == NULL)
-       {
-         global_symbol_block = buildblock (global_symbols);
-         global_symbols = NULL;
-         BLOCK_START (global_symbol_block) = scope -> lowpc + baseaddr;
-         BLOCK_END (global_symbol_block) = scope -> highpc + baseaddr;
-       }
-      scope -> block = buildblock (scope -> symbols);
-      scope -> symbols = NULL;
-      BLOCK_START (scope -> block) = scope -> lowpc + baseaddr;
-      BLOCK_END (scope -> block) = scope -> highpc + baseaddr;
-    
-      /* Put the local block in as the value of the symbol that names it.  */
-    
-      if (scope -> namesym)
-       {
-         SYMBOL_BLOCK_VALUE (scope -> namesym) = scope -> block;
-         BLOCK_FUNCTION (scope -> block) = scope -> namesym;
-       }
-    
-    /*  Install this scope's local block as the superblock of all child
-       scope blocks. */
-    
-    for (child = scope -> child ; child ; child = child -> sibling)
-      {
-       BLOCK_SUPERBLOCK (child -> block) = scope -> block;
-      }
-    
-      scope = scope -> parent;
-    }
-}
-
-/*
-
-LOCAL FUNCTION
-
-       record_line -- record a line number entry in the line vector
-
-SYNOPSIS
-
-       static void record_line (int line, CORE_ADDR pc)
-
-DESCRIPTION
-
-       Given a line number and the corresponding pc value, record
-       this pair in the line number vector, expanding the vector as
-       necessary.
- */
-
-static void
-DEFUN(record_line, (line, pc), int line AND CORE_ADDR pc)
-{
-  struct linetable_entry *e;
-  int nbytes;
-  
-  /* Make sure line vector is big enough.  */
-  
-  if (line_vector_index + 2 >= line_vector_length)
-    {
-      line_vector_length *= 2;
-      nbytes = sizeof (struct linetable);
-      nbytes += (line_vector_length * sizeof (struct linetable_entry));
-      line_vector = (struct linetable *) xrealloc (line_vector, nbytes);
-    }
-  e = line_vector -> item + line_vector_index++;
-  e -> line = line;
-  e -> pc = pc;
-}
-
-/*
-
-LOCAL FUNCTION
-
-       decode_line_numbers -- decode a line number table fragment
-
-SYNOPSIS
-
-       static void decode_line_numbers (char *tblscan, char *tblend,
-               long length, long base, long line, long pc)
-
-DESCRIPTION
-
-       Translate the DWARF line number information to gdb form.
-
-       The ".line" section contains one or more line number tables, one for
-       each ".line" section from the objects that were linked.
+       The ".line" section contains one or more line number tables, one for
+       each ".line" section from the objects that were linked.
 
        The AT_stmt_list attribute for each TAG_source_file entry in the
        ".debug" section contains the offset into the ".line" section for the
@@ -2010,7 +1681,8 @@ BUGS
  */
 
 static void
-DEFUN(decode_line_numbers, (linetable), char *linetable)
+decode_line_numbers (linetable)
+     char *linetable;
 {
   char *tblscan;
   char *tblend;
@@ -2037,7 +1709,7 @@ DEFUN(decode_line_numbers, (linetable), char *linetable)
          pc += base;
          if (line > 0)
            {
-             record_line (line, pc);
+             record_line (current_subfile, line, pc);
            }
        }
     }
@@ -2045,133 +1717,6 @@ DEFUN(decode_line_numbers, (linetable), char *linetable)
 
 /*
 
-LOCAL FUNCTION
-
-       add_symbol_to_list -- add a symbol to head of current symbol list
-
-SYNOPSIS
-
-       static void add_symbol_to_list (struct symbol *symbol, struct
-               pending_symbol **listhead)
-
-DESCRIPTION
-
-       Given a pointer to a symbol and a pointer to a pointer to a
-       list of symbols, add this symbol as the current head of the
-       list.  Typically used for example to add a symbol to the
-       symbol list for the current scope.
-
- */
-
-static void
-DEFUN(add_symbol_to_list, (symbol, listhead),
-     struct symbol *symbol AND struct pending_symbol **listhead)
-{
-  struct pending_symbol *link;
-  
-  if (symbol != NULL)
-    {
-      link = (struct pending_symbol *) xmalloc (sizeof (*link));
-      link -> next = *listhead;
-      link -> symbol = symbol;
-      *listhead = link;
-    }
-}
-
-/*
-
-LOCAL FUNCTION
-
-       gatherblocks -- walk a scope tree and build block vectors
-
-SYNOPSIS
-
-       static struct block **gatherblocks (struct block **dest,
-               struct scopenode *node)
-
-DESCRIPTION
-
-       Recursively walk a scope tree rooted in the given node, adding blocks
-       to the array pointed to by DEST, in preorder.  I.E., first we add the
-       block for the current scope, then all the blocks for child scopes,
-       and finally all the blocks for sibling scopes.
- */
-
-static struct block **
-DEFUN(gatherblocks, (dest, node),
-      struct block **dest AND struct scopenode *node)
-{
-  if (node != NULL)
-    {
-      *dest++ = node -> block;
-      dest = gatherblocks (dest, node -> child);
-      dest = gatherblocks (dest, node -> sibling);
-    }
-  return (dest);
-}
-
-/*
-
-LOCAL FUNCTION
-
-       make_blockvector -- make a block vector from current scope tree
-
-SYNOPSIS
-
-       static struct blockvector *make_blockvector (void)
-
-DESCRIPTION
-
-       Make a blockvector from all the blocks in the current scope tree.
-       The first block is always the global symbol block, followed by the
-       block for the root of the scope tree which is the local symbol block,
-       followed by all the remaining blocks in the scope tree, which are all
-       local scope blocks.
-
-NOTES
-
-       Note that since the root node of the scope tree is created at the time
-       each file scope is entered, there are always at least two blocks,
-       neither of which may have any symbols, but always contribute a block
-       to the block vector.  So the test for number of blocks greater than 1
-       below is unnecessary given bug free code.
-
-       The resulting block structure varies slightly from that produced
-       by dbxread.c, in that block 0 and block 1 are sibling blocks while
-       with dbxread.c, block 1 is a child of block 0.  This does not
-       seem to cause any problems, but probably should be fixed. (FIXME)
- */
-
-static struct blockvector *
-DEFUN_VOID(make_blockvector)
-{
-  struct blockvector *blockvector = NULL;
-  int i;
-  int nbytes;
-  
-  /* Recursively walk down the tree, counting the number of blocks.
-     Then add one to account for the global's symbol block */
-  
-  i = scopecount (scopetree) + 1;
-  nbytes = sizeof (struct blockvector);
-  if (i > 1)
-    {
-      nbytes += (i - 1) * sizeof (struct block *);
-    }
-  blockvector = (struct blockvector *)
-    obstack_alloc (symbol_obstack, nbytes);
-  
-  /* Copy the blocks into the blockvector. */
-  
-  BLOCKVECTOR_NBLOCKS (blockvector) = i;
-  BLOCKVECTOR_BLOCK (blockvector, 0) = global_symbol_block;
-  gatherblocks (&BLOCKVECTOR_BLOCK (blockvector, 1), scopetree);
-  
-  return (blockvector);
-}
-
-/*
-
 LOCAL FUNCTION
 
        locval -- compute the value of a location attribute
@@ -2203,7 +1748,8 @@ NOTES
  */
 
 static int
-DEFUN(locval, (loc), char *loc)
+locval (loc)
+     char *loc;
 {
   unsigned short nbytes;
   auto int stack[64];
@@ -2216,6 +1762,7 @@ DEFUN(locval, (loc), char *loc)
   stacki = 0;
   stack[stacki] = 0;
   isreg = 0;
+  offreg = 0;
   for (loc += sizeof (short); loc < end; loc += sizeof (long))
     {
       switch (*loc++) {
@@ -2231,6 +1778,7 @@ DEFUN(locval, (loc), char *loc)
       case OP_BASEREG:
        /* push value of register (number) */
        /* Actually, we compute the value as if register has 0 */
+       offreg = 1;
        (void) memcpy (&regno, loc, sizeof (long));
        if (regno == R_FP)
          {
@@ -2278,18 +1826,26 @@ SYNOPSIS
 
 DESCRIPTION
 
-       OFFSET is a relocation offset which gets added to each symbol (FIXME).
+       When expanding a partial symbol table entry to a full symbol table
+       entry, this is the function that gets called to read in the symbols
+       for the compilation unit.
+
+       Returns a pointer to the newly constructed symtab (which is now
+       the new first one on the objfile's symtab list).
  */
 
 static struct symtab *
-DEFUN(read_ofile_symtab, (pst),
-      struct partial_symtab *pst)
+read_ofile_symtab (pst)
+     struct partial_symtab *pst;
 {
   struct cleanup *back_to;
   long lnsize;
   int foffset;
-  bfd *abfd = pst->objfile->obfd;
-  
+  bfd *abfd;
+
+  abfd = pst -> objfile -> obfd;
+  current_objfile = pst -> objfile;
+
   /* Allocate a buffer for the entire chunk of DIE's for this compilation
      unit, seek to the location in the file, and read in all the DIE's. */
 
@@ -2297,6 +1853,7 @@ DEFUN(read_ofile_symtab, (pst),
   dbbase = xmalloc (DBLENGTH(pst));
   dbroff = DBROFF(pst);
   foffset = DBFOFF(pst) + dbroff;
+  baseaddr = pst -> addr;
   if (bfd_seek (abfd, foffset, 0) ||
       (bfd_read (dbbase, DBLENGTH(pst), 1, abfd) != DBLENGTH(pst)))
     {
@@ -2329,9 +1886,10 @@ DEFUN(read_ofile_symtab, (pst),
       make_cleanup (free, lnbase);
     }
 
-  process_dies (dbbase, dbbase + DBLENGTH(pst), pst->objfile);
+  process_dies (dbbase, dbbase + DBLENGTH(pst), pst -> objfile);
   do_cleanups (back_to);
-  return (symtab_list);
+  current_objfile = NULL;
+  return (pst -> objfile -> symtabs);
 }
 
 /*
@@ -2352,53 +1910,54 @@ DESCRIPTION
 */
 
 static void
-DEFUN(psymtab_to_symtab_1,
-      (pst),
-      struct partial_symtab *pst)
+psymtab_to_symtab_1 (pst)
+     struct partial_symtab *pst;
 {
   int i;
   
-  if (!pst)
-    {
-      return;
-    }
-  if (pst->readin)
-    {
-      fprintf (stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
-              pst -> filename);
-      return;
-    }
-  
-  /* Read in all partial symtabs on which this one is dependent */
-  for (i = 0; i < pst -> number_of_dependencies; i++)
-    if (!pst -> dependencies[i] -> readin)
-      {
-       /* Inform about additional files that need to be read in.  */
-       if (info_verbose)
-         {
-           fputs_filtered (" ", stdout);
-           wrap_here ("");
-           fputs_filtered ("and ", stdout);
-           wrap_here ("");
-           printf_filtered ("%s...", pst -> dependencies[i] -> filename);
-           wrap_here ("");             /* Flush output */
-           fflush (stdout);
-         }
-       psymtab_to_symtab_1 (pst -> dependencies[i]);
-      }
-  
-  if (DBLENGTH(pst))           /* Otherwise it's a dummy */
+  if (pst != NULL)
     {
-      /* Init stuff necessary for reading in symbols */
-      pst -> symtab = read_ofile_symtab (pst);
-      if (info_verbose)
+      if (pst->readin)
+       {
+         warning ("Psymtab for %s already read in.  Shouldn't happen.",
+                  pst -> filename);
+       }
+      else
        {
-         printf_filtered ("%d DIE's, sorting...", diecount);
-         fflush (stdout);
+         /* Read in all partial symtabs on which this one is dependent */
+         for (i = 0; i < pst -> number_of_dependencies; i++)
+           {
+             if (!pst -> dependencies[i] -> readin)
+               {
+                 /* Inform about additional files that need to be read in. */
+                 if (info_verbose)
+                   {
+                     fputs_filtered (" ", stdout);
+                     wrap_here ("");
+                     fputs_filtered ("and ", stdout);
+                     wrap_here ("");
+                     printf_filtered ("%s...",
+                                      pst -> dependencies[i] -> filename);
+                     wrap_here ("");
+                     fflush (stdout);          /* Flush output */
+                   }
+                 psymtab_to_symtab_1 (pst -> dependencies[i]);
+               }
+           }     
+         if (DBLENGTH (pst))           /* Otherwise it's a dummy */
+           {
+             pst -> symtab = read_ofile_symtab (pst);
+             if (info_verbose)
+               {
+                 printf_filtered ("%d DIE's, sorting...", diecount);
+                 wrap_here ("");
+                 fflush (stdout);
+               }
+             sort_symtab_syms (pst -> symtab);
+           }
+         pst -> readin = 1;
        }
-      sort_symtab_syms (pst -> symtab);
     }
-  pst -> readin = 1;
 }
 
 /*
@@ -2420,46 +1979,48 @@ DESCRIPTION
 */
 
 static void
-DEFUN(dwarf_psymtab_to_symtab, (pst), struct partial_symtab *pst)
+dwarf_psymtab_to_symtab (pst)
+     struct partial_symtab *pst;
 {
-  int desc;
-  bfd *sym_bfd;
-  
-  if (!pst)
-    {
-      return;
-    }
-  if (pst -> readin)
-    {
-      fprintf (stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
-              pst -> filename);
-      return;
-    }
-  
-  if (DBLENGTH(pst) || pst -> number_of_dependencies)
+
+  if (pst != NULL)
     {
-      /* Print the message now, before starting serious work, to avoid
-        disconcerting pauses.  */
-      if (info_verbose)
+      if (pst -> readin)
        {
-         printf_filtered ("Reading in symbols for %s...", pst -> filename);
-         fflush (stdout);
+         warning ("Psymtab for %s already read in.  Shouldn't happen.",
+                  pst -> filename);
        }
-      
-      psymtab_to_symtab_1 (pst);
-      
-#if 0 /* FIXME:  Check to see what dbxread is doing here and see if
-        we need to do an equivalent or is this something peculiar to
-        stabs/a.out format. */
-      /* Match with global symbols.  This only needs to be done once,
-         after all of the symtabs and dependencies have been read in.   */
-      scan_file_globals ();
-#endif
-      
-      /* Finish up the debug error message.  */
-      if (info_verbose)
+      else
        {
-         printf_filtered ("done.\n");
+         if (DBLENGTH (pst) || pst -> number_of_dependencies)
+           {
+             /* Print the message now, before starting serious work, to avoid
+                disconcerting pauses.  */
+             if (info_verbose)
+               {
+                 printf_filtered ("Reading in symbols for %s...",
+                                  pst -> filename);
+                 fflush (stdout);
+               }
+             
+             psymtab_to_symtab_1 (pst);
+             
+#if 0        /* FIXME:  Check to see what dbxread is doing here and see if
+                we need to do an equivalent or is this something peculiar to
+                stabs/a.out format.
+                Match with global symbols.  This only needs to be done once,
+                after all of the symtabs and dependencies have been read in.
+                */
+             scan_file_globals (pst -> objfile);
+#endif
+             
+             /* Finish up the verbose info message.  */
+             if (info_verbose)
+               {
+                 printf_filtered ("done.\n");
+                 fflush (stdout);
+               }
+           }
        }
     }
 }
@@ -2472,7 +2033,7 @@ LOCAL FUNCTION
 
 SYNOPSIS
 
-       static void init_psymbol_list (int total_symbols)
+       static void init_psymbol_list (struct objfile *objfile, int total_symbols)
 
 DESCRIPTION
 
@@ -2481,137 +2042,82 @@ DESCRIPTION
  */
 
 static void
-DEFUN(init_psymbol_list, (total_symbols), int total_symbols)
+init_psymbol_list (objfile, total_symbols)
+     struct objfile *objfile;
+     int total_symbols;
 {
   /* Free any previously allocated psymbol lists.  */
   
-  if (global_psymbols.list)
+  if (objfile -> global_psymbols.list)
     {
-      free (global_psymbols.list);
+      (*objfile -> free) (objfile -> global_psymbols.list);
     }
-  if (static_psymbols.list)
+  if (objfile -> static_psymbols.list)
     {
-      free (static_psymbols.list);
+      (*objfile -> free) (objfile -> static_psymbols.list);
     }
   
   /* Current best guess is that there are approximately a twentieth
      of the total symbols (in a debugging file) are global or static
      oriented symbols */
   
-  global_psymbols.size = total_symbols / 10;
-  static_psymbols.size = total_symbols / 10;
-  global_psymbols.next = global_psymbols.list = (struct partial_symbol *)
-    xmalloc (global_psymbols.size * sizeof (struct partial_symbol));
-  static_psymbols.next = static_psymbols.list = (struct partial_symbol *)
-    xmalloc (static_psymbols.size * sizeof (struct partial_symbol));
-}
-
-/*
-
-LOCAL FUNCTION
-
-       start_psymtab -- allocate and partially fill a partial symtab entry
-
-DESCRIPTION
-
-       Allocate and partially fill a partial symtab.  It will be completely
-       filled at the end of the symbol list.
-   
-       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 (normal).  FILENAME is the name of the compilation unit that
-       these symbols were defined in, and they appear starting a address
-       TEXTLOW.  DBROFF is the absolute file offset in SYMFILE_NAME where
-       the full symbols can be read for compilation unit FILENAME.
-       GLOBAL_SYMS and STATIC_SYMS are pointers to the current end of the
-       psymtab vector.
-
- */
-
-static struct partial_symtab *
-DEFUN(start_psymtab,
-      (objfile, addr, filename, textlow, texthigh, dbfoff, curoff,
-       culength, lnfoff, global_syms, static_syms),
-      struct objfile *objfile AND
-      CORE_ADDR addr AND
-      char *filename AND
-      CORE_ADDR textlow AND
-      CORE_ADDR texthigh AND
-      int dbfoff AND
-      int curoff AND
-      int culength AND
-      int lnfoff AND
-      struct partial_symbol *global_syms AND
-      struct partial_symbol *static_syms)
-{
-  struct partial_symtab *result;
-
-  result = (struct partial_symtab *)
-      obstack_alloc (psymbol_obstack, sizeof (struct partial_symtab));
-  (void) memset (result, 0, sizeof (struct partial_symtab));
-  result -> addr = addr;
-  result -> objfile = objfile;
-  result -> filename = create_name (filename, psymbol_obstack);
-  result -> textlow = textlow;
-  result -> texthigh = texthigh;
-  result -> read_symtab_private = (char *) obstack_alloc (psymbol_obstack,
-                                                 sizeof (struct dwfinfo));
-  DBFOFF (result) = dbfoff;
-  DBROFF (result) = curoff;
-  DBLENGTH (result) = culength;
-  LNFOFF (result)  = lnfoff;
-  result -> readin = 0;
-  result -> symtab = NULL;
-  result -> read_symtab = dwarf_psymtab_to_symtab;
-  result -> globals_offset = global_syms - global_psymbols.list;
-  result -> statics_offset = static_syms - static_psymbols.list;
-  
-  result->n_global_syms = 0;
-  result->n_static_syms = 0;
-  
-  return result;
+  objfile -> global_psymbols.size = total_symbols / 10;
+  objfile -> static_psymbols.size = total_symbols / 10;
+  objfile -> global_psymbols.next =
+    objfile -> global_psymbols.list = (struct partial_symbol *)
+      (*objfile -> xmalloc) (objfile -> global_psymbols.size
+                            * sizeof (struct partial_symbol));
+  objfile -> static_psymbols.next =
+    objfile -> static_psymbols.list = (struct partial_symbol *)
+      (*objfile -> xmalloc) (objfile -> static_psymbols.size
+                            * sizeof (struct partial_symbol));
 }
 
 /*
 
 LOCAL FUNCTION
 
-       add_psymbol_to_list -- add a partial symbol to given list
+       add_enum_psymbol -- add enumeration members to partial symbol table
 
 DESCRIPTION
 
-       Add a partial symbol to one of the partial symbol vectors (pointed to
-       by listp).  The vector is grown as necessary.
-
- */
+       Given pointer to a DIE that is known to be for an enumeration,
+       extract the symbolic names of the enumeration members and add
+       partial symbols for them.
+*/
 
 static void
-DEFUN(add_psymbol_to_list,
-      (listp, name, space, class, value),
-      struct psymbol_allocation_list *listp AND
-      char *name AND
-      enum namespace space AND
-      enum address_class class AND
-      CORE_ADDR value)
+add_enum_psymbol (dip, objfile)
+     struct dieinfo *dip;
+     struct objfile *objfile;
 {
-  struct partial_symbol *psym;
-  int newsize;
+  char *scan;
+  char *listend;
+  long ltemp;
+  short stemp;
   
-  if (listp -> next >= listp -> list + listp -> size)
-    {
-      newsize = listp -> size * 2;
-      listp -> list = (struct partial_symbol *)
-       xrealloc (listp -> list, (newsize * sizeof (struct partial_symbol)));
-      /* Next assumes we only went one over.  Should be good if program works
-        correctly */
-      listp -> next = listp -> list + listp -> size;
-      listp -> size = newsize;
-    }
-  psym = listp -> next++;
-  SYMBOL_NAME (psym) = create_name (name, psymbol_obstack);
-  SYMBOL_NAMESPACE (psym) = space;
-  SYMBOL_CLASS (psym) = class;
-  SYMBOL_VALUE (psym) = value;
+  if ((scan = dip -> at_element_list) != NULL)
+    {
+      if (dip -> short_element_list)
+       {
+         (void) memcpy (&stemp, scan, sizeof (stemp));
+         listend = scan + stemp + sizeof (stemp);
+         scan += sizeof (stemp);
+       }
+      else
+       {
+         (void) memcpy (&ltemp, scan, sizeof (ltemp));
+         listend = scan + ltemp + sizeof (ltemp);
+         scan += sizeof (ltemp);
+       }
+      while (scan < listend)
+       {
+         scan += sizeof (long);
+         ADD_PSYMBOL_TO_LIST (scan, strlen (scan), VAR_NAMESPACE, LOC_CONST,
+                              objfile -> static_psymbols, 0);
+         scan += strlen (scan) + 1;
+       }
+    }
 }
 
 /*
@@ -2629,38 +2135,62 @@ DESCRIPTION
 */
 
 static void
-DEFUN(add_partial_symbol, (dip), struct dieinfo *dip)
+add_partial_symbol (dip, objfile)
+     struct dieinfo *dip;
+     struct objfile *objfile;
 {
   switch (dip -> dietag)
     {
     case TAG_global_subroutine:
-      record_misc_function (dip -> at_name, dip -> at_low_pc, mf_text);
-      add_psymbol_to_list (&global_psymbols, dip -> at_name, VAR_NAMESPACE,
-                          LOC_BLOCK, dip -> at_low_pc);
+      record_minimal_symbol (dip -> at_name, dip -> at_low_pc, mst_text,
+                           objfile);
+      ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+                          VAR_NAMESPACE, LOC_BLOCK,
+                          objfile -> global_psymbols,
+                          dip -> at_low_pc);
       break;
     case TAG_global_variable:
-      record_misc_function (dip -> at_name, locval (dip -> at_location),
-                           mf_data);
-      add_psymbol_to_list (&global_psymbols, dip -> at_name, VAR_NAMESPACE,
-                          LOC_STATIC, 0);
+      record_minimal_symbol (dip -> at_name, locval (dip -> at_location),
+                           mst_data, objfile);
+      ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+                          VAR_NAMESPACE, LOC_STATIC,
+                          objfile -> global_psymbols,
+                          0);
       break;
     case TAG_subroutine:
-      add_psymbol_to_list (&static_psymbols, dip -> at_name, VAR_NAMESPACE,
-                          LOC_BLOCK, dip -> at_low_pc);
+      ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+                          VAR_NAMESPACE, LOC_BLOCK,
+                          objfile -> static_psymbols,
+                          dip -> at_low_pc);
       break;
     case TAG_local_variable:
-      add_psymbol_to_list (&static_psymbols, dip -> at_name, VAR_NAMESPACE,
-                          LOC_STATIC, 0);
+      ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+                          VAR_NAMESPACE, LOC_STATIC,
+                          objfile -> static_psymbols,
+                          0);
       break;
     case TAG_typedef:
-      add_psymbol_to_list (&static_psymbols, dip -> at_name, VAR_NAMESPACE,
-                          LOC_TYPEDEF, 0);
+      ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+                          VAR_NAMESPACE, LOC_TYPEDEF,
+                          objfile -> static_psymbols,
+                          0);
       break;
     case TAG_structure_type:
     case TAG_union_type:
+      ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+                          STRUCT_NAMESPACE, LOC_TYPEDEF,
+                          objfile -> static_psymbols,
+                          0);
+      break;
     case TAG_enumeration_type:
-      add_psymbol_to_list (&static_psymbols, dip -> at_name, STRUCT_NAMESPACE,
-                          LOC_TYPEDEF, 0);
+      if (dip -> at_name)
+       {
+         ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
+                              STRUCT_NAMESPACE, LOC_TYPEDEF,
+                              objfile -> static_psymbols,
+                              0);
+       }
+      add_enum_psymbol (dip, objfile);
       break;
     }
 }
@@ -2678,14 +2208,27 @@ DESCRIPTION
        for this compilation unit.  Since we cannot follow any sibling
        chains without reading the complete DIE info for every DIE,
        it is probably faster to just sequentially check each one to
-       see if it is one of the types we are interested in, and if
-       so, then extracting all the attributes info and generating a
-       partial symbol table entry.
+       see if it is one of the types we are interested in, and if so,
+       then extract all the attributes info and generate a partial
+       symbol table entry.
+
+NOTES
+
+       Don't attempt to add anonymous structures or unions since they have
+       no name.  Anonymous enumerations however are processed, because we
+       want to extract their member names (the check for a tag name is
+       done later).
 
+       Also, for variables and subroutines, check that this is the place
+       where the actual definition occurs, rather than just a reference
+       to an external.
  */
 
 static void
-DEFUN(scan_partial_symbols, (thisdie, enddie), char *thisdie AND char *enddie)
+scan_partial_symbols (thisdie, enddie, objfile)
+     char *thisdie;
+     char *enddie;
+     struct objfile *objfile;
 {
   char *nextdie;
   struct dieinfo di;
@@ -2700,26 +2243,33 @@ DEFUN(scan_partial_symbols, (thisdie, enddie), char *thisdie AND char *enddie)
       else
        {
          nextdie = thisdie + di.dielength;
+         /* To avoid getting complete die information for every die, we
+            only do it (below) for the cases we are interested in. */
          switch (di.dietag)
            {
            case TAG_global_subroutine:
-           case TAG_global_variable:
            case TAG_subroutine:
+           case TAG_global_variable:
            case TAG_local_variable:
+             completedieinfo (&di);
+             if (di.at_name && (di.has_at_low_pc || di.at_location))
+               {
+                 add_partial_symbol (&di, objfile);
+               }
+             break;
            case TAG_typedef:
            case TAG_structure_type:
            case TAG_union_type:
-           case TAG_enumeration_type:
              completedieinfo (&di);
-             /* Don't attempt to add anonymous structures, unions, or
-                enumerations since they have no name.  Also check that
-                this is the place where the actual definition occurs,
-                rather than just a reference to an external. */
-             if (di.at_name != NULL && !di.at_is_external_p)
+             if (di.at_name)
                {
-                 add_partial_symbol (&di);
+                 add_partial_symbol (&di, objfile);
                }
              break;
+           case TAG_enumeration_type:
+             completedieinfo (&di);
+             add_partial_symbol (&di, objfile);
+             break;
            }
        }
       thisdie = nextdie;
@@ -2770,15 +2320,13 @@ RETURNS
  */
 
 static void
-DEFUN(scan_compilation_units,
-      (filename, addr, thisdie, enddie, dbfoff, lnoffset, objfile),
-      char *filename AND
-      CORE_ADDR addr AND
-      char *thisdie AND
-      char *enddie AND
-      unsigned int dbfoff AND
-      unsigned int lnoffset AND
-      struct objfile *objfile)
+scan_compilation_units (filename, thisdie, enddie, dbfoff, lnoffset, objfile)
+     char *filename;
+     char *thisdie;
+     char *enddie;
+     unsigned int dbfoff;
+     unsigned int lnoffset;
+     struct objfile *objfile;
 {
   char *nextdie;
   struct dieinfo di;
@@ -2811,28 +2359,38 @@ DEFUN(scan_compilation_units,
            }
          curoff = thisdie - dbbase;
          culength = nextdie - thisdie;
-         curlnoffset = di.at_stmt_list_p ? lnoffset + di.at_stmt_list : 0;
-         pst = start_psymtab (objfile, addr, di.at_name,
-                                    di.at_low_pc, di.at_high_pc,
-                                    dbfoff, curoff, culength, curlnoffset,
-                                    global_psymbols.next,
-                                    static_psymbols.next);
-         scan_partial_symbols (thisdie + di.dielength, nextdie);
-         pst -> n_global_syms = global_psymbols.next -
-           (global_psymbols.list + pst -> globals_offset);
-         pst -> n_static_syms = static_psymbols.next - 
-           (static_psymbols.list + pst -> statics_offset);
-         /* Sort the global list; don't sort the static list */
-         qsort (global_psymbols.list + pst -> globals_offset,
-                pst -> n_global_syms, sizeof (struct partial_symbol),
-                compare_psymbols);
+         curlnoffset = di.has_at_stmt_list ? lnoffset + di.at_stmt_list : 0;
+
+         /* First allocate a new partial symbol table structure */
+
+         pst = start_psymtab_common (objfile, baseaddr, di.at_name,
+                                     di.at_low_pc,
+                                     objfile -> global_psymbols.next,
+                                     objfile -> static_psymbols.next);
+
+         pst -> texthigh = di.at_high_pc;
+         pst -> read_symtab_private = (char *)
+             obstack_alloc (&objfile -> psymbol_obstack,
+                            sizeof (struct dwfinfo));
+         DBFOFF (pst) = dbfoff;
+         DBROFF (pst) = curoff;
+         DBLENGTH (pst) = culength;
+         LNFOFF (pst)  = curlnoffset;
+         pst -> read_symtab = dwarf_psymtab_to_symtab;
+
+         /* Now look for partial symbols */
+
+         scan_partial_symbols (thisdie + di.dielength, nextdie, objfile);
+
+         pst -> n_global_syms = objfile -> global_psymbols.next -
+           (objfile -> global_psymbols.list + pst -> globals_offset);
+         pst -> n_static_syms = objfile -> static_psymbols.next - 
+           (objfile -> static_psymbols.list + pst -> statics_offset);
+         sort_pst_symbols (pst);
          /* 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.)  This happens in VxWorks.  */
          free_named_symtabs (pst -> filename);
-         /* Place the partial symtab on the partial symtab list */
-         pst -> next = partial_symtab_list;
-         partial_symtab_list = pst;
        }
       thisdie = nextdie;      
     }
@@ -2846,7 +2404,8 @@ LOCAL FUNCTION
 
 SYNOPSIS
 
-       static struct symbol *new_symbol (struct dieinfo *dip)
+       static struct symbol *new_symbol (struct dieinfo *dip,
+                                         struct objfile *objfile)
 
 DESCRIPTION
 
@@ -2856,16 +2415,18 @@ DESCRIPTION
  */
 
 static struct symbol *
-DEFUN(new_symbol, (dip), struct dieinfo *dip)
+new_symbol (dip, objfile)
+     struct dieinfo *dip;
+     struct objfile *objfile;
 {
   struct symbol *sym = NULL;
   
   if (dip -> at_name != NULL)
     {
-      sym = (struct symbol *) obstack_alloc (symbol_obstack,
+      sym = (struct symbol *) obstack_alloc (&objfile -> symbol_obstack,
                                             sizeof (struct symbol));
       (void) memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = create_name (dip -> at_name, symbol_obstack);
+      SYMBOL_NAME (sym) = create_name (dip -> at_name, &objfile->symbol_obstack);
       /* default assumptions */
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       SYMBOL_CLASS (sym) = LOC_STATIC;
@@ -2873,12 +2434,12 @@ DEFUN(new_symbol, (dip), struct dieinfo *dip)
       switch (dip -> dietag)
        {
        case TAG_label:
-         SYMBOL_VALUE (sym) = dip -> at_low_pc + baseaddr;
+         SYMBOL_VALUE (sym) = dip -> at_low_pc;
          SYMBOL_CLASS (sym) = LOC_LABEL;
          break;
        case TAG_global_subroutine:
        case TAG_subroutine:
-         SYMBOL_VALUE (sym) = dip -> at_low_pc + baseaddr;
+         SYMBOL_VALUE (sym) = dip -> at_low_pc;
          SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym));
          SYMBOL_CLASS (sym) = LOC_BLOCK;
          if (dip -> dietag == TAG_global_subroutine)
@@ -2887,34 +2448,30 @@ DEFUN(new_symbol, (dip), struct dieinfo *dip)
            }
          else
            {
-             add_symbol_to_list (sym, &scope -> symbols);
+             add_symbol_to_list (sym, list_in_scope);
            }
          break;
        case TAG_global_variable:
-       case TAG_local_variable:
          if (dip -> at_location != NULL)
            {
              SYMBOL_VALUE (sym) = locval (dip -> at_location);
-           }
-         if (dip -> dietag == TAG_global_variable)
-           {
              add_symbol_to_list (sym, &global_symbols);
              SYMBOL_CLASS (sym) = LOC_STATIC;
              SYMBOL_VALUE (sym) += baseaddr;
            }
-         else
+         break;
+       case TAG_local_variable:
+         if (dip -> at_location != NULL)
            {
-             add_symbol_to_list (sym, &scope -> symbols);
-             if (scope -> parent != NULL)
+             SYMBOL_VALUE (sym) = locval (dip -> at_location);
+             add_symbol_to_list (sym, list_in_scope);
+             if (isreg)
                {
-                 if (isreg)
-                   {
-                     SYMBOL_CLASS (sym) = LOC_REGISTER;
-                   }
-                 else
-                   {
-                     SYMBOL_CLASS (sym) = LOC_LOCAL;
-                   }
+                 SYMBOL_CLASS (sym) = LOC_REGISTER;
+               }
+             else if (offreg)
+               {
+                 SYMBOL_CLASS (sym) = LOC_LOCAL;
                }
              else
                {
@@ -2928,7 +2485,7 @@ DEFUN(new_symbol, (dip), struct dieinfo *dip)
            {
              SYMBOL_VALUE (sym) = locval (dip -> at_location);
            }
-         add_symbol_to_list (sym, &scope -> symbols);
+         add_symbol_to_list (sym, list_in_scope);
          if (isreg)
            {
              SYMBOL_CLASS (sym) = LOC_REGPARM;
@@ -2947,12 +2504,12 @@ DEFUN(new_symbol, (dip), struct dieinfo *dip)
        case TAG_enumeration_type:
          SYMBOL_CLASS (sym) = LOC_TYPEDEF;
          SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
-         add_symbol_to_list (sym, &scope -> symbols);
+         add_symbol_to_list (sym, list_in_scope);
          break;
        case TAG_typedef:
          SYMBOL_CLASS (sym) = LOC_TYPEDEF;
          SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-         add_symbol_to_list (sym, &scope -> symbols);
+         add_symbol_to_list (sym, list_in_scope);
          break;
        default:
          /* Not a tag we recognize.  Hopefully we aren't processing trash
@@ -2988,7 +2545,8 @@ DESCRIPTION
 */
 
 static struct type *
-DEFUN(decode_mod_fund_type, (typedata), char *typedata)
+decode_mod_fund_type (typedata)
+     char *typedata;
 {
   struct type *typep = NULL;
   unsigned short modcount;
@@ -3029,7 +2587,8 @@ DESCRIPTION
 */
 
 static struct type *
-DEFUN(decode_mod_u_d_type, (typedata), char *typedata)
+decode_mod_u_d_type (typedata)
+     char *typedata;
 {
   struct type *typep = NULL;
   unsigned short modcount;
@@ -3087,9 +2646,10 @@ BUGS
  */
 
 static struct type *
-DEFUN(decode_modified_type,
-      (modifiers, modcount, mtype),
-      unsigned char *modifiers AND unsigned short modcount AND int mtype)
+decode_modified_type (modifiers, modcount, mtype)
+     unsigned char *modifiers;
+     unsigned int modcount;
+     int mtype;
 {
   struct type *typep = NULL;
   unsigned short fundtype;
@@ -3113,7 +2673,7 @@ DEFUN(decode_modified_type,
          break;
        default:
          SQUAWK (("botched modified type decoding (mtype 0x%x)", mtype));
-         typep = builtin_type_int;
+         typep = lookup_fundamental_type (current_objfile, FT_INTEGER);
          break;
        }
     }
@@ -3163,11 +2723,12 @@ NOTES
        If we encounter a fundamental type that we are unprepared to
        deal with, and it is not in the range of those types defined
        as application specific types, then we issue a warning and
-       treat the type as builtin_type_int.
+       treat the type as an "int".
 */
 
 static struct type *
-DEFUN(decode_fund_type, (fundtype), unsigned short fundtype)
+decode_fund_type (fundtype)
+     unsigned int fundtype;
 {
   struct type *typep = NULL;
   
@@ -3175,85 +2736,108 @@ DEFUN(decode_fund_type, (fundtype), unsigned short fundtype)
     {
 
     case FT_void:
-      typep = builtin_type_void;
+      typep = lookup_fundamental_type (current_objfile, FT_VOID);
       break;
     
+    case FT_boolean:           /* Was FT_set in AT&T version */
+      typep = lookup_fundamental_type (current_objfile, FT_BOOLEAN);
+      break;
+
     case FT_pointer:           /* (void *) */
-      typep = lookup_pointer_type (builtin_type_void);
+      typep = lookup_fundamental_type (current_objfile, FT_VOID);
+      typep = lookup_pointer_type (typep);
       break;
     
     case FT_char:
+      typep = lookup_fundamental_type (current_objfile, FT_CHAR);
+      break;
+    
     case FT_signed_char:
-      typep = builtin_type_char;
+      typep = lookup_fundamental_type (current_objfile, FT_SIGNED_CHAR);
+      break;
+
+    case FT_unsigned_char:
+      typep = lookup_fundamental_type (current_objfile, FT_UNSIGNED_CHAR);
       break;
     
     case FT_short:
+      typep = lookup_fundamental_type (current_objfile, FT_SHORT);
+      break;
+
     case FT_signed_short:
-      typep = builtin_type_short;
+      typep = lookup_fundamental_type (current_objfile, FT_SIGNED_SHORT);
+      break;
+    
+    case FT_unsigned_short:
+      typep = lookup_fundamental_type (current_objfile, FT_UNSIGNED_SHORT);
       break;
     
     case FT_integer:
+      typep = lookup_fundamental_type (current_objfile, FT_INTEGER);
+      break;
+
     case FT_signed_integer:
-    case FT_boolean:           /* Was FT_set in AT&T version */
-      typep = builtin_type_int;
+      typep = lookup_fundamental_type (current_objfile, FT_SIGNED_INTEGER);
+      break;
+    
+    case FT_unsigned_integer:
+      typep = lookup_fundamental_type (current_objfile, FT_UNSIGNED_INTEGER);
       break;
     
     case FT_long:
+      typep = lookup_fundamental_type (current_objfile, FT_LONG);
+      break;
+
     case FT_signed_long:
-      typep = builtin_type_long;
+      typep = lookup_fundamental_type (current_objfile, FT_SIGNED_LONG);
       break;
     
-    case FT_float:
-      typep = builtin_type_float;
+    case FT_unsigned_long:
+      typep = lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG);
       break;
     
-    case FT_dbl_prec_float:
-      typep = builtin_type_double;
+    case FT_long_long:
+      typep = lookup_fundamental_type (current_objfile, FT_LONG_LONG);
       break;
-    
-    case FT_unsigned_char:
-      typep = builtin_type_unsigned_char;
+
+    case FT_signed_long_long:
+      typep = lookup_fundamental_type (current_objfile, FT_SIGNED_LONG_LONG);
       break;
-    
-    case FT_unsigned_short:
-      typep = builtin_type_unsigned_short;
+
+    case FT_unsigned_long_long:
+      typep = lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG_LONG);
       break;
-    
-    case FT_unsigned_integer:
-      typep = builtin_type_unsigned_int;
+
+    case FT_float:
+      typep = lookup_fundamental_type (current_objfile, FT_FLOAT);
       break;
     
-    case FT_unsigned_long:
-      typep = builtin_type_unsigned_long;
+    case FT_dbl_prec_float:
+      typep = lookup_fundamental_type (current_objfile, FT_DBL_PREC_FLOAT);
       break;
     
     case FT_ext_prec_float:
-      typep = builtin_type_long_double;
+      typep = lookup_fundamental_type (current_objfile, FT_EXT_PREC_FLOAT);
       break;
     
     case FT_complex:
-      typep = builtin_type_complex;
+      typep = lookup_fundamental_type (current_objfile, FT_COMPLEX);
       break;
     
     case FT_dbl_prec_complex:
-      typep = builtin_type_double_complex;
+      typep = lookup_fundamental_type (current_objfile, FT_DBL_PREC_COMPLEX);
       break;
     
-    case FT_long_long:
-    case FT_signed_long_long:
-      typep = builtin_type_long_long;
+    case FT_ext_prec_complex:
+      typep = lookup_fundamental_type (current_objfile, FT_EXT_PREC_COMPLEX);
       break;
-
-    case FT_unsigned_long_long:
-      typep = builtin_type_unsigned_long_long;
-      break;
-
+    
     }
 
   if ((typep == NULL) && !(FT_lo_user <= fundtype && fundtype <= FT_hi_user))
     {
       SQUAWK (("unexpected fundamental type 0x%x", fundtype));
-      typep = builtin_type_void;
+      typep = lookup_fundamental_type (current_objfile, FT_VOID);
     }
     
   return (typep);
@@ -3273,7 +2857,9 @@ DESCRIPTION
 */
 
 static char *
-DEFUN(create_name, (name, obstackp), char *name AND struct obstack *obstackp)
+create_name (name, obstackp)
+     char *name;
+     struct obstack *obstackp;
 {
   int length;
   char *newname;
@@ -3331,7 +2917,9 @@ NOTES
  */
 
 static void
-DEFUN(basicdieinfo, (dip, diep), struct dieinfo *dip AND char *diep)
+basicdieinfo (dip, diep)
+     struct dieinfo *dip;
+     char *diep;
 {
   curdie = dip;
   (void) memset (dip, 0, sizeof (struct dieinfo));
@@ -3384,7 +2972,8 @@ NOTES
  */
 
 static void
-DEFUN(completedieinfo, (dip), struct dieinfo *dip)
+completedieinfo (dip)
+     struct dieinfo *dip;
 {
   char *diep;                  /* Current pointer into raw DIE data */
   char *end;                   /* Terminate DIE scan here */
@@ -3420,13 +3009,16 @@ DEFUN(completedieinfo, (dip), struct dieinfo *dip)
          break;
        case AT_stmt_list:
          (void) memcpy (&dip -> at_stmt_list, diep, sizeof (long));
-         dip -> at_stmt_list_p = 1;
+         dip -> has_at_stmt_list = 1;
          break;
        case AT_low_pc:
          (void) memcpy (&dip -> at_low_pc, diep, sizeof (long));
+         dip -> at_low_pc += baseaddr;
+         dip -> has_at_low_pc = 1;
          break;
        case AT_high_pc:
          (void) memcpy (&dip -> at_high_pc, diep, sizeof (long));
+         dip -> at_high_pc += baseaddr;
          break;
        case AT_language:
          (void) memcpy (&dip -> at_language, diep, sizeof (long));
@@ -3461,11 +3053,13 @@ DEFUN(completedieinfo, (dip), struct dieinfo *dip)
        case AT_mod_u_d_type:
          dip -> at_mod_u_d_type = diep;
          break;
-       case AT_deriv_list:
-         dip -> at_deriv_list = diep;
-         break;
        case AT_element_list:
          dip -> at_element_list = diep;
+         dip -> short_element_list = 0;
+         break;
+       case AT_short_element_list:
+         dip -> at_element_list = diep;
+         dip -> short_element_list = 1;
          break;
        case AT_discr_value:
          dip -> at_discr_value = diep;
@@ -3482,15 +3076,9 @@ DEFUN(completedieinfo, (dip), struct dieinfo *dip)
        case AT_producer:
          dip -> at_producer = diep;
          break;
-       case AT_loclist:
-         (void) memcpy (&dip -> at_loclist, diep, sizeof (long));
-         break;
        case AT_frame_base:
          (void) memcpy (&dip -> at_frame_base, diep, sizeof (long));
          break;
-       case AT_incomplete:
-         (void) memcpy (&dip -> at_incomplete, diep, sizeof (short));
-         break;
        case AT_start_scope:
          (void) memcpy (&dip -> at_start_scope, diep, sizeof (long));
          break;
@@ -3503,13 +3091,6 @@ DEFUN(completedieinfo, (dip), struct dieinfo *dip)
        case AT_prototyped:
          (void) memcpy (&dip -> at_prototyped, diep, sizeof (short));
          break;
-       case AT_const_data:
-         dip -> at_const_data = diep;
-         break;
-       case AT_is_external:
-         (void) memcpy (&dip -> at_is_external, diep, sizeof (short));
-         dip -> at_is_external_p = 1;
-         break;
        default:
          /* Found an attribute that we are unprepared to handle.  However
             it is specifically one of the design goals of DWARF that
This page took 0.056956 seconds and 4 git commands to generate.