remove diff indicators
[deliverable/binutils-gdb.git] / gdb / dwarfread.c
index c56155e87c439f788957fdc46b12946e389acb84..6eb0a0b06ed3d7350537d89ccacaea195a4969a5 100644 (file)
@@ -1,5 +1,6 @@
 /* DWARF debugging format support for GDB.
-   Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1998
+   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+   2001
    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.
@@ -189,11 +190,6 @@ typedef unsigned int DIE_REF;      /* Reference to a DIE */
 #define CHILL_PRODUCER "GNU Chill "
 #endif
 
-/* Provide a default mapping from a DWARF register number to a gdb REGNUM.  */
-#ifndef DWARF_REG_TO_REGNUM
-#define DWARF_REG_TO_REGNUM(num) (num)
-#endif
-
 /* Flags to target_to_host() that tell whether or not the data object is
    expected to be signed.  Used, for example, when fetching a signed
    integer in the target environment which is used as a signed integer
@@ -245,7 +241,6 @@ typedef unsigned int DIE_REF;       /* Reference to a DIE */
 
 /* External variables referenced. */
 
-extern int info_verbose;       /* From main.c; nonzero => verbose */
 extern char *warning_pre_print;        /* From utils.c */
 
 /* The DWARF debugging information consists of two major pieces,
@@ -576,9 +571,7 @@ static struct type *dwarf_fundamental_type (struct objfile *, int);
  */
 
 static struct type *
-dwarf_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+dwarf_fundamental_type (struct objfile *objfile, int typeid)
 {
   if (typeid < 0 || typeid >= FT_NUM_MEMBERS)
     {
@@ -621,8 +614,7 @@ dwarf_fundamental_type (objfile, typeid)
  */
 
 static void
-set_cu_language (dip)
-     struct dieinfo *dip;
+set_cu_language (struct dieinfo *dip)
 {
   switch (dip->at_language)
     {
@@ -690,14 +682,9 @@ set_cu_language (dip)
  */
 
 void
-dwarf_build_psymtabs (objfile, mainline, dbfoff, dbfsize,
-                     lnoffset, lnsize)
-     struct objfile *objfile;
-     int mainline;
-     file_ptr dbfoff;
-     unsigned int dbfsize;
-     file_ptr lnoffset;
-     unsigned int lnsize;
+dwarf_build_psymtabs (struct objfile *objfile, int mainline, file_ptr dbfoff,
+                     unsigned int dbfsize, file_ptr lnoffset,
+                     unsigned int lnsize)
 {
   bfd *abfd = objfile->obfd;
   struct cleanup *back_to;
@@ -707,19 +694,20 @@ dwarf_build_psymtabs (objfile, mainline, dbfoff, dbfsize,
   dbbase = xmalloc (dbsize);
   dbroff = 0;
   if ((bfd_seek (abfd, dbfoff, SEEK_SET) != 0) ||
-      (bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
+      (bfd_bread (dbbase, dbsize, abfd) != dbsize))
     {
-      free (dbbase);
+      xfree (dbbase);
       error ("can't read DWARF data from '%s'", bfd_get_filename (abfd));
     }
-  back_to = make_cleanup (free, dbbase);
+  back_to = make_cleanup (xfree, dbbase);
 
   /* If we are reinitializing, or if we have never loaded syms yet, init.
      Since we have no idea how many DIES we are looking at, we just guess
      some arbitrary value. */
 
-  if (mainline || objfile->global_psymbols.size == 0 ||
-      objfile->static_psymbols.size == 0)
+  if (mainline
+      || (objfile->global_psymbols.size == 0
+         && objfile->static_psymbols.size == 0))
     {
       init_psymbol_list (objfile, 1024);
     }
@@ -758,11 +746,8 @@ dwarf_build_psymtabs (objfile, mainline, dbfoff, dbfsize,
  */
 
 static void
-read_lexical_block_scope (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_lexical_block_scope (struct dieinfo *dip, char *thisdie, char *enddie,
+                         struct objfile *objfile)
 {
   register struct context_stack *new;
 
@@ -797,8 +782,7 @@ read_lexical_block_scope (dip, thisdie, enddie, objfile)
  */
 
 static struct type *
-lookup_utype (die_ref)
-     DIE_REF die_ref;
+lookup_utype (DIE_REF die_ref)
 {
   struct type *type = NULL;
   int utypeidx;
@@ -838,9 +822,7 @@ lookup_utype (die_ref)
  */
 
 static struct type *
-alloc_utype (die_ref, utypep)
-     DIE_REF die_ref;
-     struct type *utypep;
+alloc_utype (DIE_REF die_ref, struct type *utypep)
 {
   struct type **typep;
   int utypeidx;
@@ -886,10 +868,9 @@ alloc_utype (die_ref, utypep)
  */
 
 static void
-free_utypes (dummy)
-     PTR dummy;
+free_utypes (PTR dummy)
 {
-  free (utypes);
+  xfree (utypes);
   utypes = NULL;
   numutypes = 0;
 }
@@ -913,8 +894,7 @@ free_utypes (dummy)
  */
 
 static struct type *
-decode_die_type (dip)
-     struct dieinfo *dip;
+decode_die_type (struct dieinfo *dip)
 {
   struct type *type = NULL;
 
@@ -965,11 +945,8 @@ decode_die_type (dip)
  */
 
 static struct type *
-struct_type (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
+            struct objfile *objfile)
 {
   struct type *type;
   struct nextfield
@@ -1163,11 +1140,8 @@ struct_type (dip, thisdie, enddie, objfile)
  */
 
 static void
-read_structure_scope (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_structure_scope (struct dieinfo *dip, char *thisdie, char *enddie,
+                     struct objfile *objfile)
 {
   struct type *type;
   struct symbol *sym;
@@ -1207,8 +1181,7 @@ read_structure_scope (dip, thisdie, enddie, objfile)
  */
 
 static struct type *
-decode_array_element_type (scan)
-     char *scan;
+decode_array_element_type (char *scan)
 {
   struct type *typep;
   DIE_REF die_ref;
@@ -1302,9 +1275,7 @@ decode_array_element_type (scan)
  */
 
 static struct type *
-decode_subscript_data_item (scan, end)
-     char *scan;
-     char *end;
+decode_subscript_data_item (char *scan, char *end)
 {
   struct type *typep = NULL;   /* Array type we are building */
   struct type *nexttype;       /* Type of each element (may be array) */
@@ -1384,8 +1355,7 @@ decode_subscript_data_item (scan, end)
  */
 
 static void
-dwarf_read_array_type (dip)
-     struct dieinfo *dip;
+dwarf_read_array_type (struct dieinfo *dip)
 {
   struct type *type;
   struct type *utype;
@@ -1449,8 +1419,7 @@ dwarf_read_array_type (dip)
  */
 
 static void
-read_tag_pointer_type (dip)
-     struct dieinfo *dip;
+read_tag_pointer_type (struct dieinfo *dip)
 {
   struct type *type;
   struct type *utype;
@@ -1492,8 +1461,7 @@ read_tag_pointer_type (dip)
  */
 
 static void
-read_tag_string_type (dip)
-     struct dieinfo *dip;
+read_tag_string_type (struct dieinfo *dip)
 {
   struct type *utype;
   struct type *indextype;
@@ -1564,10 +1532,7 @@ read_tag_string_type (dip)
  */
 
 static void
-read_subroutine_type (dip, thisdie, enddie)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
+read_subroutine_type (struct dieinfo *dip, char *thisdie, char *enddie)
 {
   struct type *type;           /* Type that this function returns */
   struct type *ftype;          /* Function that returns above type */
@@ -1624,11 +1589,8 @@ read_subroutine_type (dip, thisdie, enddie)
  */
 
 static void
-read_enumeration (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_enumeration (struct dieinfo *dip, char *thisdie, char *enddie,
+                 struct objfile *objfile)
 {
   struct type *type;
   struct symbol *sym;
@@ -1677,9 +1639,7 @@ read_enumeration (dip, thisdie, enddie, objfile)
  */
 
 static struct type *
-enum_type (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+enum_type (struct dieinfo *dip, struct objfile *objfile)
 {
   struct type *type;
   struct nextfield
@@ -1805,11 +1765,8 @@ enum_type (dip, objfile)
  */
 
 static void
-read_func_scope (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_func_scope (struct dieinfo *dip, char *thisdie, char *enddie,
+                struct objfile *objfile)
 {
   register struct context_stack *new;
 
@@ -1855,8 +1812,7 @@ read_func_scope (dip, thisdie, enddie, objfile)
  */
 
 static void
-handle_producer (producer)
-     char *producer;
+handle_producer (char *producer)
 {
 
   /* If this compilation unit was compiled with g++ or gcc, then set the
@@ -1883,7 +1839,11 @@ handle_producer (producer)
     {
       if (STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)))
        {
+#if 0
+         /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't
+            know whether it will use the old style or v3 mangling.  */
          set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
+#endif
        }
       else if (STREQN (producer, LCC_PRODUCER, strlen (LCC_PRODUCER)))
        {
@@ -1916,11 +1876,8 @@ handle_producer (producer)
  */
 
 static void
-read_file_scope (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_file_scope (struct dieinfo *dip, char *thisdie, char *enddie,
+                struct objfile *objfile)
 {
   struct cleanup *back_to;
   struct symtab *symtab;
@@ -1972,10 +1929,7 @@ read_file_scope (dip, thisdie, enddie, objfile)
  */
 
 static void
-process_dies (thisdie, enddie, objfile)
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+process_dies (char *thisdie, char *enddie, struct objfile *objfile)
 {
   char *nextdie;
   struct dieinfo di;
@@ -2118,8 +2072,7 @@ process_dies (thisdie, enddie, objfile)
  */
 
 static void
-decode_line_numbers (linetable)
-     char *linetable;
+decode_line_numbers (char *linetable)
 {
   char *tblscan;
   char *tblend;
@@ -2192,8 +2145,7 @@ decode_line_numbers (linetable)
  */
 
 static int
-locval (dip)
-     struct dieinfo *dip;
+locval (struct dieinfo *dip)
 {
   unsigned short nbytes;
   unsigned short locsize;
@@ -2294,8 +2246,7 @@ locval (dip)
  */
 
 static void
-read_ofile_symtab (pst)
-     struct partial_symtab *pst;
+read_ofile_symtab (struct partial_symtab *pst)
 {
   struct cleanup *back_to;
   unsigned long lnsize;
@@ -2317,12 +2268,12 @@ read_ofile_symtab (pst)
   base_section_offsets = pst->section_offsets;
   baseaddr = ANOFFSET (pst->section_offsets, 0);
   if (bfd_seek (abfd, foffset, SEEK_SET) ||
-      (bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
+      (bfd_bread (dbbase, dbsize, abfd) != dbsize))
     {
-      free (dbbase);
+      xfree (dbbase);
       error ("can't read DWARF data");
     }
-  back_to = make_cleanup (free, dbbase);
+  back_to = make_cleanup (xfree, dbbase);
 
   /* If there is a line number table associated with this compilation unit
      then read the size of this fragment in bytes, from the fragment itself.
@@ -2333,8 +2284,8 @@ read_ofile_symtab (pst)
   if (LNFOFF (pst))
     {
       if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) ||
-         (bfd_read ((PTR) lnsizedata, sizeof (lnsizedata), 1, abfd) !=
-          sizeof (lnsizedata)))
+         (bfd_bread ((PTR) lnsizedata, sizeof (lnsizedata), abfd)
+          != sizeof (lnsizedata)))
        {
          error ("can't read DWARF line number table size");
        }
@@ -2342,12 +2293,12 @@ read_ofile_symtab (pst)
                               GET_UNSIGNED, pst->objfile);
       lnbase = xmalloc (lnsize);
       if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) ||
-         (bfd_read (lnbase, lnsize, 1, abfd) != lnsize))
+         (bfd_bread (lnbase, lnsize, abfd) != lnsize))
        {
-         free (lnbase);
+         xfree (lnbase);
          error ("can't read DWARF line numbers");
        }
-      make_cleanup (free, lnbase);
+      make_cleanup (xfree, lnbase);
     }
 
   process_dies (dbbase, dbbase + dbsize, pst->objfile);
@@ -2374,8 +2325,7 @@ read_ofile_symtab (pst)
  */
 
 static void
-psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   int i;
   struct cleanup *old_chain;
@@ -2447,8 +2397,7 @@ psymtab_to_symtab_1 (pst)
  */
 
 static void
-dwarf_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+dwarf_psymtab_to_symtab (struct partial_symtab *pst)
 {
 
   if (pst != NULL)
@@ -2507,9 +2456,7 @@ dwarf_psymtab_to_symtab (pst)
  */
 
 static void
-add_enum_psymbol (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+add_enum_psymbol (struct dieinfo *dip, struct objfile *objfile)
 {
   char *scan;
   char *listend;
@@ -2558,9 +2505,7 @@ add_enum_psymbol (dip, objfile)
  */
 
 static void
-add_partial_symbol (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+add_partial_symbol (struct dieinfo *dip, struct objfile *objfile)
 {
   switch (dip->die_tag)
     {
@@ -2685,10 +2630,7 @@ NOTES
 
 
 static void
-scan_partial_symbols (thisdie, enddie, objfile)
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+scan_partial_symbols (char *thisdie, char *enddie, struct objfile *objfile)
 {
   char *nextdie;
   char *temp;
@@ -2809,12 +2751,8 @@ scan_partial_symbols (thisdie, enddie, objfile)
  */
 
 static void
-scan_compilation_units (thisdie, enddie, dbfoff, lnoffset, objfile)
-     char *thisdie;
-     char *enddie;
-     file_ptr dbfoff;
-     file_ptr lnoffset;
-     struct objfile *objfile;
+scan_compilation_units (char *thisdie, char *enddie, file_ptr dbfoff,
+                       file_ptr lnoffset, struct objfile *objfile)
 {
   char *nextdie;
   struct dieinfo di;
@@ -2904,9 +2842,7 @@ scan_compilation_units (thisdie, enddie, dbfoff, lnoffset, objfile)
  */
 
 static struct symbol *
-new_symbol (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+new_symbol (struct dieinfo *dip, struct objfile *objfile)
 {
   struct symbol *sym = NULL;
 
@@ -3066,10 +3002,8 @@ new_symbol (dip, objfile)
  */
 
 static void
-synthesize_typedef (dip, objfile, type)
-     struct dieinfo *dip;
-     struct objfile *objfile;
-     struct type *type;
+synthesize_typedef (struct dieinfo *dip, struct objfile *objfile,
+                   struct type *type)
 {
   struct symbol *sym = NULL;
 
@@ -3113,8 +3047,7 @@ synthesize_typedef (dip, objfile, type)
  */
 
 static struct type *
-decode_mod_fund_type (typedata)
-     char *typedata;
+decode_mod_fund_type (char *typedata)
 {
   struct type *typep = NULL;
   unsigned short modcount;
@@ -3160,8 +3093,7 @@ decode_mod_fund_type (typedata)
  */
 
 static struct type *
-decode_mod_u_d_type (typedata)
-     char *typedata;
+decode_mod_u_d_type (char *typedata)
 {
   struct type *typep = NULL;
   unsigned short modcount;
@@ -3224,10 +3156,7 @@ decode_mod_u_d_type (typedata)
  */
 
 static struct type *
-decode_modified_type (modifiers, modcount, mtype)
-     char *modifiers;
-     unsigned int modcount;
-     int mtype;
+decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
 {
   struct type *typep = NULL;
   unsigned short fundtype;
@@ -3313,8 +3242,7 @@ decode_modified_type (modifiers, modcount, mtype)
  */
 
 static struct type *
-decode_fund_type (fundtype)
-     unsigned int fundtype;
+decode_fund_type (unsigned int fundtype)
 {
   struct type *typep = NULL;
 
@@ -3446,9 +3374,7 @@ decode_fund_type (fundtype)
  */
 
 static char *
-create_name (name, obstackp)
-     char *name;
-     struct obstack *obstackp;
+create_name (char *name, struct obstack *obstackp)
 {
   int length;
   char *newname;
@@ -3514,10 +3440,7 @@ create_name (name, obstackp)
  */
 
 static void
-basicdieinfo (dip, diep, objfile)
-     struct dieinfo *dip;
-     char *diep;
-     struct objfile *objfile;
+basicdieinfo (struct dieinfo *dip, char *diep, struct objfile *objfile)
 {
   curdie = dip;
   memset (dip, 0, sizeof (struct dieinfo));
@@ -3576,9 +3499,7 @@ basicdieinfo (dip, diep, objfile)
  */
 
 static void
-completedieinfo (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+completedieinfo (struct dieinfo *dip, struct objfile *objfile)
 {
   char *diep;                  /* Current pointer into raw DIE data */
   char *end;                   /* Terminate DIE scan here */
@@ -3790,11 +3711,8 @@ completedieinfo (dip, objfile)
  */
 
 static CORE_ADDR
-target_to_host (from, nbytes, signextend, objfile)
-     char *from;
-     int nbytes;
-     int signextend;           /* FIXME:  Unused */
-     struct objfile *objfile;
+target_to_host (char *from, int nbytes, int signextend,        /* FIXME:  Unused */
+               struct objfile *objfile)
 {
   CORE_ADDR rtnval;
 
@@ -3841,8 +3759,7 @@ target_to_host (from, nbytes, signextend, objfile)
  */
 
 static int
-attribute_size (attr)
-     unsigned int attr;
+attribute_size (unsigned int attr)
 {
   int nbytes;                  /* Size of next data for this attribute */
   unsigned short form;         /* Form of the attribute */
This page took 0.031861 seconds and 4 git commands to generate.