libiberty/ChangeLog:
[deliverable/binutils-gdb.git] / gdb / dwarfread.c
index 8d15175cde3d6cf6531284d969555a83ef7c3d3f..bbfecbc29f53c18ca1770bfdfce19c0f520c324d 100644 (file)
@@ -1,6 +1,8 @@
 /* DWARF debugging format support for GDB.
-   Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1998
-   Free Software Foundation, Inc.
+
+   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001, 2002, 2003 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.
 
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+/*
+   If you are looking for DWARF-2 support, you are in the wrong file.
+   Go look in dwarf2read.c.  This file is for the original DWARF.
+
+   DWARF (also known as DWARF-1) is headed for obsoletion.
+
+   In gcc 3.2.1, these targets prefer dwarf-1:
+
+     i[34567]86-sequent-ptx4*   # TD-R2
+     i[34567]86-sequent-sysv4*  # TD-R2
+     i[34567]86-dg-dgux*        # obsolete in gcc 3.2.1, to be removed in 3.3
+     m88k-dg-dgux*              # TD-R2
+     mips-sni-sysv4             # TD-R2
+     sparc-hal-solaris2*        # TD-R2
+
+    Configurations marked with "# TD-R2" are on Zach Weinberg's list
+    of "Target Deprecation, Round 2".  This is a candidate list of
+    targets to be deprecated in gcc 3.3 and removed in gcc 3.4.
+
+      http://gcc.gnu.org/ml/gcc/2002-12/msg00702.html
+
+    gcc 2.95.3 had many configurations which prefer dwarf-1.
+    We may have to support dwarf-1 as long as we support gcc 2.95.3.
+    This could use more analysis.
+
+    DG/UX (Data General Unix) used dwarf-1 for its native format.
+    DG/UX uses gcc for its system C compiler, but they have their
+    own linker and their own debuggers.
+
+    Takis Psarogiannakopoulos has a complete gnu toolchain for DG/UX
+    with gcc 2.95.3, gdb 5.1, and debug formats of dwarf-2 and stabs.
+    For more info, see PR gdb/979 and PR gdb/1013; also:
+
+      http://sources.redhat.com/ml/gdb/2003-02/msg00074.html
+
+    There may be non-gcc compilers that still emit dwarf-1.
+
+    -- chastain 2003-02-04
+*/
+
 /*
 
    FIXME: Do we need to generate dependencies in partial symtabs?
 
 /* Complaints that can be issued during DWARF debug info reading. */
 
-struct complaint no_bfd_get_N =
-{
-  "DIE @ 0x%x \"%s\", no bfd support for %d byte data object", 0, 0
-};
-
-struct complaint malformed_die =
-{
-  "DIE @ 0x%x \"%s\", malformed DIE, bad length (%d bytes)", 0, 0
-};
-
-struct complaint bad_die_ref =
-{
-  "DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit", 0, 0
-};
-
-struct complaint unknown_attribute_form =
-{
-  "DIE @ 0x%x \"%s\", unknown attribute form (0x%x)", 0, 0
-};
-
-struct complaint unknown_attribute_length =
-{
-  "DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes", 0, 0
-};
-
-struct complaint unexpected_fund_type =
-{
-  "DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x", 0, 0
-};
-
-struct complaint unknown_type_modifier =
-{
-  "DIE @ 0x%x \"%s\", unknown type modifier %u", 0, 0
-};
-
-struct complaint volatile_ignored =
-{
-  "DIE @ 0x%x \"%s\", type modifier 'volatile' ignored", 0, 0
-};
-
-struct complaint const_ignored =
-{
-  "DIE @ 0x%x \"%s\", type modifier 'const' ignored", 0, 0
-};
-
-struct complaint botched_modified_type =
-{
-  "DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)", 0, 0
-};
-
-struct complaint op_deref2 =
-{
-  "DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%x not handled", 0, 0
-};
-
-struct complaint op_deref4 =
-{
-  "DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%x not handled", 0, 0
-};
-
-struct complaint basereg_not_handled =
-{
-  "DIE @ 0x%x \"%s\", BASEREG %d not handled", 0, 0
-};
-
-struct complaint dup_user_type_allocation =
-{
-  "DIE @ 0x%x \"%s\", internal error: duplicate user type allocation", 0, 0
-};
-
-struct complaint dup_user_type_definition =
-{
-  "DIE @ 0x%x \"%s\", internal error: duplicate user type definition", 0, 0
-};
-
-struct complaint missing_tag =
-{
-  "DIE @ 0x%x \"%s\", missing class, structure, or union tag", 0, 0
-};
-
-struct complaint bad_array_element_type =
-{
-  "DIE @ 0x%x \"%s\", bad array element type attribute 0x%x", 0, 0
-};
-
-struct complaint subscript_data_items =
-{
-  "DIE @ 0x%x \"%s\", can't decode subscript data items", 0, 0
-};
-
-struct complaint unhandled_array_subscript_format =
+static void
+bad_die_ref_complaint (int arg1, const char *arg2, int arg3)
 {
-  "DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet", 0, 0
-};
+  complaint (&symfile_complaints,
+            "DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit",
+            arg1, arg2, arg3);
+}
 
-struct complaint unknown_array_subscript_format =
+static void
+unknown_attribute_form_complaint (int arg1, const char *arg2, int arg3)
 {
-  "DIE @ 0x%x \"%s\", unknown array subscript format %x", 0, 0
-};
+  complaint (&symfile_complaints,
+            "DIE @ 0x%x \"%s\", unknown attribute form (0x%x)", arg1, arg2,
+            arg3);
+}
 
-struct complaint not_row_major =
+static void
+dup_user_type_definition_complaint (int arg1, const char *arg2)
 {
-  "DIE @ 0x%x \"%s\", array not row major; not handled correctly", 0, 0
-};
+  complaint (&symfile_complaints,
+            "DIE @ 0x%x \"%s\", internal error: duplicate user type definition",
+            arg1, arg2);
+}
 
-struct complaint missing_at_name =
+static void
+bad_array_element_type_complaint (int arg1, const char *arg2, int arg3)
 {
-  "DIE @ 0x%x, AT_name tag missing", 0, 0
-};
+  complaint (&symfile_complaints,
+            "DIE @ 0x%x \"%s\", bad array element type attribute 0x%x", arg1,
+            arg2, arg3);
+}
 
 typedef unsigned int DIE_REF;  /* Reference to a DIE */
 
@@ -185,10 +149,6 @@ typedef unsigned int DIE_REF;      /* Reference to a DIE */
 #define LCC_PRODUCER "NCR C/C++"
 #endif
 
-#ifndef CHILL_PRODUCER
-#define CHILL_PRODUCER "GNU Chill "
-#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
@@ -238,11 +198,6 @@ typedef unsigned int DIE_REF;      /* Reference to a DIE */
 
 #define        AT_short_element_list    (0x00f0|FORM_BLOCK2)
 
-/* 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,
    one is a block of DWARF Information Entries (DIE's) and the other
    is a line number table.  The "struct dieinfo" structure contains
@@ -445,7 +400,7 @@ static const struct language_defn *cu_language_defn;
 /* Forward declarations of static functions so we don't have to worry
    about ordering within this file.  */
 
-static void free_utypes (PTR);
+static void free_utypes (void *);
 
 static int attribute_size (unsigned int);
 
@@ -455,19 +410,19 @@ static void add_enum_psymbol (struct dieinfo *, struct objfile *);
 
 static void handle_producer (char *);
 
-static void
-read_file_scope (struct dieinfo *, char *, char *, struct objfile *);
+static void read_file_scope (struct dieinfo *, char *, char *,
+                            struct objfile *);
 
-static void
-read_func_scope (struct dieinfo *, char *, char *, struct objfile *);
+static void read_func_scope (struct dieinfo *, char *, char *,
+                            struct objfile *);
 
-static void
-read_lexical_block_scope (struct dieinfo *, char *, char *, struct objfile *);
+static void read_lexical_block_scope (struct dieinfo *, char *, char *,
+                                     struct objfile *);
 
 static void scan_partial_symbols (char *, char *, struct objfile *);
 
-static void
-scan_compilation_units (char *, char *, file_ptr, file_ptr, struct objfile *);
+static void scan_compilation_units (char *, char *, file_ptr, file_ptr,
+                                   struct objfile *);
 
 static void add_partial_symbol (struct dieinfo *, struct objfile *);
 
@@ -483,8 +438,8 @@ static void read_ofile_symtab (struct partial_symtab *);
 
 static void process_dies (char *, char *, struct objfile *);
 
-static void
-read_structure_scope (struct dieinfo *, char *, char *, struct objfile *);
+static void read_structure_scope (struct dieinfo *, char *, char *,
+                                 struct objfile *);
 
 static struct type *decode_array_element_type (char *);
 
@@ -498,8 +453,8 @@ static void read_tag_string_type (struct dieinfo *dip);
 
 static void read_subroutine_type (struct dieinfo *, char *, char *);
 
-static void
-read_enumeration (struct dieinfo *, char *, char *, struct objfile *);
+static void read_enumeration (struct dieinfo *, char *, char *,
+                             struct objfile *);
 
 static struct type *struct_type (struct dieinfo *, char *, char *,
                                 struct objfile *);
@@ -526,8 +481,8 @@ static struct type *alloc_utype (DIE_REF, struct type *);
 
 static struct symbol *new_symbol (struct dieinfo *, struct objfile *);
 
-static void
-synthesize_typedef (struct dieinfo *, struct objfile *, struct type *);
+static void synthesize_typedef (struct dieinfo *, struct objfile *,
+                               struct type *);
 
 static int locval (struct dieinfo *);
 
@@ -625,9 +580,6 @@ set_cu_language (struct dieinfo *dip)
     case LANG_C_PLUS_PLUS:
       cu_language = language_cplus;
       break;
-    case LANG_CHILL:
-      cu_language = language_chill;
-      break;
     case LANG_MODULA2:
       cu_language = language_m2;
       break;
@@ -694,7 +646,7 @@ dwarf_build_psymtabs (struct objfile *objfile, int mainline, file_ptr dbfoff,
   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))
     {
       xfree (dbbase);
       error ("can't read DWARF data from '%s'", bfd_get_filename (abfd));
@@ -705,8 +657,9 @@ dwarf_build_psymtabs (struct objfile *objfile, int mainline, file_ptr dbfoff,
      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);
     }
@@ -789,7 +742,7 @@ lookup_utype (DIE_REF die_ref)
   utypeidx = (die_ref - dbroff) / 4;
   if ((utypeidx < 0) || (utypeidx >= numutypes))
     {
-      complain (&bad_die_ref, DIE_ID, DIE_NAME);
+      bad_die_ref_complaint (DIE_ID, DIE_NAME, die_ref);
     }
   else
     {
@@ -831,12 +784,14 @@ alloc_utype (DIE_REF die_ref, struct type *utypep)
   if ((utypeidx < 0) || (utypeidx >= numutypes))
     {
       utypep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
-      complain (&bad_die_ref, DIE_ID, DIE_NAME);
+      bad_die_ref_complaint (DIE_ID, DIE_NAME, die_ref);
     }
   else if (*typep != NULL)
     {
       utypep = *typep;
-      complain (&dup_user_type_allocation, DIE_ID, DIE_NAME);
+      complaint (&symfile_complaints,
+                "DIE @ 0x%x \"%s\", internal error: duplicate user type allocation",
+                DIE_ID, DIE_NAME);
     }
   else
     {
@@ -857,7 +812,7 @@ alloc_utype (DIE_REF die_ref, struct type *utypep)
 
    SYNOPSIS
 
-   static void free_utypes (PTR dummy)
+   static void free_utypes (void *dummy)
 
    DESCRIPTION
 
@@ -867,7 +822,7 @@ alloc_utype (DIE_REF die_ref, struct type *utypep)
  */
 
 static void
-free_utypes (PTR dummy)
+free_utypes (void *dummy)
 {
   xfree (utypes);
   utypes = NULL;
@@ -981,7 +936,9 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
     default:
       /* Should never happen */
       TYPE_CODE (type) = TYPE_CODE_UNDEF;
-      complain (&missing_tag, DIE_ID, DIE_NAME);
+      complaint (&symfile_complaints,
+                "DIE @ 0x%x \"%s\", missing class, structure, or union tag",
+                DIE_ID, DIE_NAME);
       break;
     }
   /* Some compilers try to be helpful by inventing "fake" names for
@@ -1030,6 +987,7 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
                          &objfile->type_obstack);
          FIELD_TYPE (list->field) = decode_die_type (&mbr);
          FIELD_BITPOS (list->field) = 8 * locval (&mbr);
+         FIELD_STATIC_KIND (list->field) = 0;
          /* Handle bit fields. */
          FIELD_BITSIZE (list->field) = mbr.at_bit_size;
          if (BITS_BIG_ENDIAN)
@@ -1146,7 +1104,7 @@ read_structure_scope (struct dieinfo *dip, char *thisdie, char *enddie,
   struct symbol *sym;
 
   type = struct_type (dip, thisdie, enddie, objfile);
-  if (!(TYPE_FLAGS (type) & TYPE_FLAG_STUB))
+  if (!TYPE_STUB (type))
     {
       sym = new_symbol (dip, objfile);
       if (sym != NULL)
@@ -1193,7 +1151,7 @@ decode_array_element_type (char *scan)
   scan += SIZEOF_ATTRIBUTE;
   if ((nbytes = attribute_size (attribute)) == -1)
     {
-      complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute);
+      bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute);
       typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
     }
   else
@@ -1220,7 +1178,7 @@ decode_array_element_type (char *scan)
          typep = decode_mod_u_d_type (scan);
          break;
        default:
-         complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute);
+         bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute);
          typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
          break;
        }
@@ -1308,7 +1266,9 @@ decode_subscript_data_item (char *scan, char *end)
       if (nexttype == NULL)
        {
          /* Munged subscript data or other problem, fake it. */
-         complain (&subscript_data_items, DIE_ID, DIE_NAME);
+         complaint (&symfile_complaints,
+                    "DIE @ 0x%x \"%s\", can't decode subscript data items",
+                    DIE_ID, DIE_NAME);
          nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
        }
       rangetype = create_range_type ((struct type *) NULL, indextype,
@@ -1322,13 +1282,17 @@ decode_subscript_data_item (char *scan, char *end)
     case FMT_UT_C_X:
     case FMT_UT_X_C:
     case FMT_UT_X_X:
-      complain (&unhandled_array_subscript_format, DIE_ID, DIE_NAME, format);
+      complaint (&symfile_complaints,
+                "DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet",
+                DIE_ID, DIE_NAME, format);
       nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
       rangetype = create_range_type ((struct type *) NULL, nexttype, 0, 0);
       typep = create_array_type ((struct type *) NULL, nexttype, rangetype);
       break;
     default:
-      complain (&unknown_array_subscript_format, DIE_ID, DIE_NAME, format);
+      complaint (&symfile_complaints,
+                "DIE @ 0x%x \"%s\", unknown array subscript format %x", DIE_ID,
+                DIE_NAME, format);
       nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
       rangetype = create_range_type ((struct type *) NULL, nexttype, 0, 0);
       typep = create_array_type ((struct type *) NULL, nexttype, rangetype);
@@ -1366,7 +1330,9 @@ dwarf_read_array_type (struct dieinfo *dip)
   if (dip->at_ordering != ORD_row_major)
     {
       /* FIXME:  Can gdb even handle column major arrays? */
-      complain (&not_row_major, DIE_ID, DIE_NAME);
+      complaint (&symfile_complaints,
+                "DIE @ 0x%x \"%s\", array not row major; not handled correctly",
+                DIE_ID, DIE_NAME);
     }
   if ((sub = dip->at_subscr_data) != NULL)
     {
@@ -1396,7 +1362,7 @@ dwarf_read_array_type (struct dieinfo *dip)
        {
          /* Double ick!  Not only is a type already in our slot, but
             someone has decorated it.  Complain and leave it alone. */
-         complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
+         dup_user_type_definition_complaint (DIE_ID, DIE_NAME);
        }
     }
 }
@@ -1494,7 +1460,7 @@ read_tag_string_type (struct dieinfo *dip)
          is a blank one.  If not, complain and leave it alone. */
       if (TYPE_CODE (utype) != TYPE_CODE_UNDEF)
        {
-         complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
+         dup_user_type_definition_complaint (DIE_ID, DIE_NAME);
          return;
        }
     }
@@ -1560,7 +1526,7 @@ read_subroutine_type (struct dieinfo *dip, char *thisdie, char *enddie)
     }
   else
     {
-      complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
+      dup_user_type_definition_complaint (DIE_ID, DIE_NAME);
     }
 }
 
@@ -1623,7 +1589,7 @@ read_enumeration (struct dieinfo *dip, char *thisdie, char *enddie,
    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,
+   symbol for it with domain VAR_DOMAIN and class LOC_CONST,
    and give it the type of the enumeration itself.
 
    NOTES
@@ -1697,6 +1663,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile)
          list = new;
          FIELD_TYPE (list->field) = NULL;
          FIELD_BITSIZE (list->field) = 0;
+         FIELD_STATIC_KIND (list->field) = 0;
          FIELD_BITPOS (list->field) =
            target_to_host (scan, TARGET_FT_LONG_SIZE (objfile), GET_SIGNED,
                            objfile);
@@ -1709,10 +1676,10 @@ enum_type (struct dieinfo *dip, struct objfile *objfile)
          sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                                 sizeof (struct symbol));
          memset (sym, 0, sizeof (struct symbol));
-         SYMBOL_NAME (sym) = create_name (list->field.name,
+         DEPRECATED_SYMBOL_NAME (sym) = create_name (list->field.name,
                                           &objfile->symbol_obstack);
          SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
-         SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+         SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
          SYMBOL_CLASS (sym) = LOC_CONST;
          SYMBOL_TYPE (sym) = type;
          SYMBOL_VALUE (sym) = FIELD_BITPOS (list->field);
@@ -1775,7 +1742,8 @@ read_func_scope (struct dieinfo *dip, char *thisdie, char *enddie,
      FIXME: Add code to handle AT_abstract_origin tags properly.  */
   if (dip->at_name == NULL)
     {
-      complain (&missing_at_name, DIE_ID);
+      complaint (&symfile_complaints, "DIE @ 0x%x, AT_name tag missing",
+                DIE_ID);
       return;
     }
 
@@ -1825,8 +1793,7 @@ handle_producer (char *producer)
   else
     {
       processing_gcc_compilation =
-       STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER))
-       || STREQN (producer, CHILL_PRODUCER, strlen (CHILL_PRODUCER));
+       STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER));
     }
 
   /* Select a demangling style if we can identify the producer and if
@@ -1955,11 +1922,9 @@ process_dies (char *thisdie, char *enddie, struct objfile *objfile)
            {
              nextdie = thisdie + di.die_length;
            }
-#ifdef SMASH_TEXT_ADDRESS
          /* I think that these are always text, not data, addresses.  */
-         SMASH_TEXT_ADDRESS (di.at_low_pc);
-         SMASH_TEXT_ADDRESS (di.at_high_pc);
-#endif
+         di.at_low_pc = SMASH_TEXT_ADDRESS (di.at_low_pc);
+         di.at_high_pc = SMASH_TEXT_ADDRESS (di.at_high_pc);
          switch (di.die_tag)
            {
            case TAG_compile_unit:
@@ -2211,10 +2176,14 @@ locval (struct dieinfo *dip)
          break;
        case OP_DEREF2:
          /* pop, deref and push 2 bytes (as a long) */
-         complain (&op_deref2, DIE_ID, DIE_NAME, stack[stacki]);
+         complaint (&symfile_complaints,
+                    "DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%lx not handled",
+                    DIE_ID, DIE_NAME, stack[stacki]);
          break;
        case OP_DEREF4: /* pop, deref and push 4 bytes (as a long) */
-         complain (&op_deref4, DIE_ID, DIE_NAME, stack[stacki]);
+         complaint (&symfile_complaints,
+                    "DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%lx not handled",
+                    DIE_ID, DIE_NAME, stack[stacki]);
          break;
        case OP_ADD:            /* pop top 2 items, add, push result */
          stack[stacki - 1] += stack[stacki];
@@ -2267,7 +2236,7 @@ read_ofile_symtab (struct partial_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))
     {
       xfree (dbbase);
       error ("can't read DWARF data");
@@ -2283,8 +2252,8 @@ read_ofile_symtab (struct partial_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 (lnsizedata, sizeof (lnsizedata), abfd)
+          != sizeof (lnsizedata)))
        {
          error ("can't read DWARF line number table size");
        }
@@ -2292,7 +2261,7 @@ read_ofile_symtab (struct partial_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))
        {
          xfree (lnbase);
          error ("can't read DWARF line numbers");
@@ -2478,7 +2447,7 @@ add_enum_psymbol (struct dieinfo *dip, struct objfile *objfile)
       while (scan < listend)
        {
          scan += TARGET_FT_LONG_SIZE (objfile);
-         add_psymbol_to_list (scan, strlen (scan), VAR_NAMESPACE, LOC_CONST,
+         add_psymbol_to_list (scan, strlen (scan), VAR_DOMAIN, LOC_CONST,
                               &objfile->static_psymbols, 0, 0, cu_language,
                               objfile);
          scan += strlen (scan) + 1;
@@ -2510,31 +2479,31 @@ add_partial_symbol (struct dieinfo *dip, struct objfile *objfile)
     {
     case TAG_global_subroutine:
       add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
-                          VAR_NAMESPACE, LOC_BLOCK,
+                          VAR_DOMAIN, LOC_BLOCK,
                           &objfile->global_psymbols,
                           0, dip->at_low_pc, cu_language, objfile);
       break;
     case TAG_global_variable:
       add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
-                          VAR_NAMESPACE, LOC_STATIC,
+                          VAR_DOMAIN, LOC_STATIC,
                           &objfile->global_psymbols,
                           0, 0, cu_language, objfile);
       break;
     case TAG_subroutine:
       add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
-                          VAR_NAMESPACE, LOC_BLOCK,
+                          VAR_DOMAIN, LOC_BLOCK,
                           &objfile->static_psymbols,
                           0, dip->at_low_pc, cu_language, objfile);
       break;
     case TAG_local_variable:
       add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
-                          VAR_NAMESPACE, LOC_STATIC,
+                          VAR_DOMAIN, LOC_STATIC,
                           &objfile->static_psymbols,
                           0, 0, cu_language, objfile);
       break;
     case TAG_typedef:
       add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
-                          VAR_NAMESPACE, LOC_TYPEDEF,
+                          VAR_DOMAIN, LOC_TYPEDEF,
                           &objfile->static_psymbols,
                           0, 0, cu_language, objfile);
       break;
@@ -2546,14 +2515,14 @@ add_partial_symbol (struct dieinfo *dip, struct objfile *objfile)
       if (!dip->has_at_byte_size)
        break;
       add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
-                          STRUCT_NAMESPACE, LOC_TYPEDEF,
+                          STRUCT_DOMAIN, LOC_TYPEDEF,
                           &objfile->static_psymbols,
                           0, 0, cu_language, objfile);
       if (cu_language == language_cplus)
        {
          /* For C++, these implicitly act as typedefs as well. */
          add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
-                              VAR_NAMESPACE, LOC_TYPEDEF,
+                              VAR_DOMAIN, LOC_TYPEDEF,
                               &objfile->static_psymbols,
                               0, 0, cu_language, objfile);
        }
@@ -2664,8 +2633,8 @@ scan_partial_symbols (char *thisdie, char *enddie, struct objfile *objfile)
                      temp = dbbase + di.at_sibling - dbroff;
                      if ((temp < thisdie) || (temp >= enddie))
                        {
-                         complain (&bad_die_ref, DIE_ID, DIE_NAME,
-                                   di.at_sibling);
+                         bad_die_ref_complaint (DIE_ID, DIE_NAME,
+                                                di.at_sibling);
                        }
                      else
                        {
@@ -2851,10 +2820,8 @@ new_symbol (struct dieinfo *dip, struct objfile *objfile)
                                             sizeof (struct symbol));
       OBJSTAT (objfile, n_syms++);
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = create_name (dip->at_name,
-                                      &objfile->symbol_obstack);
       /* default assumptions */
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+      SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       SYMBOL_CLASS (sym) = LOC_STATIC;
       SYMBOL_TYPE (sym) = decode_die_type (dip);
 
@@ -2864,7 +2831,7 @@ new_symbol (struct dieinfo *dip, struct objfile *objfile)
          C++ symbol lookups by a factor of about 20. */
 
       SYMBOL_LANGUAGE (sym) = cu_language;
-      SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
+      SYMBOL_SET_NAMES (sym, dip->at_name, strlen (dip->at_name), objfile);
       switch (dip->die_tag)
        {
        case TAG_label:
@@ -2960,12 +2927,12 @@ new_symbol (struct dieinfo *dip, struct objfile *objfile)
        case TAG_union_type:
        case TAG_enumeration_type:
          SYMBOL_CLASS (sym) = LOC_TYPEDEF;
-         SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
+         SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
          add_symbol_to_list (sym, list_in_scope);
          break;
        case TAG_typedef:
          SYMBOL_CLASS (sym) = LOC_TYPEDEF;
-         SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+         SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
          add_symbol_to_list (sym, list_in_scope);
          break;
        default:
@@ -3012,12 +2979,12 @@ synthesize_typedef (struct dieinfo *dip, struct objfile *objfile,
        obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
       OBJSTAT (objfile, n_syms++);
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = create_name (dip->at_name,
+      DEPRECATED_SYMBOL_NAME (sym) = create_name (dip->at_name,
                                       &objfile->symbol_obstack);
       SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
       SYMBOL_TYPE (sym) = type;
       SYMBOL_CLASS (sym) = LOC_TYPEDEF;
-      SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+      SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       add_symbol_to_list (sym, list_in_scope);
     }
 }
@@ -3183,7 +3150,9 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
            }
          break;
        default:
-         complain (&botched_modified_type, DIE_ID, DIE_NAME, mtype);
+         complaint (&symfile_complaints,
+                    "DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)",
+                    DIE_ID, DIE_NAME, mtype);
          typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
          break;
        }
@@ -3201,16 +3170,22 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
          typep = lookup_reference_type (typep);
          break;
        case MOD_const:
-         complain (&const_ignored, DIE_ID, DIE_NAME);  /* FIXME */
+         complaint (&symfile_complaints,
+                    "DIE @ 0x%x \"%s\", type modifier 'const' ignored", DIE_ID,
+                    DIE_NAME); /* FIXME */
          break;
        case MOD_volatile:
-         complain (&volatile_ignored, DIE_ID, DIE_NAME);       /* FIXME */
+         complaint (&symfile_complaints,
+                    "DIE @ 0x%x \"%s\", type modifier 'volatile' ignored",
+                    DIE_ID, DIE_NAME); /* FIXME */
          break;
        default:
          if (!(MOD_lo_user <= (unsigned char) modifier
                && (unsigned char) modifier <= MOD_hi_user))
            {
-             complain (&unknown_type_modifier, DIE_ID, DIE_NAME, modifier);
+             complaint (&symfile_complaints,
+                        "DIE @ 0x%x \"%s\", unknown type modifier %u", DIE_ID,
+                        DIE_NAME, modifier);
            }
          break;
        }
@@ -3352,7 +3327,9 @@ decode_fund_type (unsigned int fundtype)
       typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
       if (!(FT_lo_user <= fundtype && fundtype <= FT_hi_user))
        {
-         complain (&unexpected_fund_type, DIE_ID, DIE_NAME, fundtype);
+         complaint (&symfile_complaints,
+                    "DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x",
+                    DIE_ID, DIE_NAME, fundtype);
        }
     }
 
@@ -3450,7 +3427,9 @@ basicdieinfo (struct dieinfo *dip, char *diep, struct objfile *objfile)
   if ((dip->die_length < SIZEOF_DIE_LENGTH) ||
       ((diep + dip->die_length) > (dbbase + dbsize)))
     {
-      complain (&malformed_die, DIE_ID, DIE_NAME, dip->die_length);
+      complaint (&symfile_complaints,
+                "DIE @ 0x%x \"%s\", malformed DIE, bad length (%ld bytes)",
+                DIE_ID, DIE_NAME, dip->die_length);
       dip->die_length = 0;
     }
   else if (dip->die_length < (SIZEOF_DIE_LENGTH + SIZEOF_DIE_TAG))
@@ -3516,7 +3495,9 @@ completedieinfo (struct dieinfo *dip, struct objfile *objfile)
       diep += SIZEOF_ATTRIBUTE;
       if ((nbytes = attribute_size (attr)) == -1)
        {
-         complain (&unknown_attribute_length, DIE_ID, DIE_NAME);
+         complaint (&symfile_complaints,
+                    "DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes",
+                    DIE_ID, DIE_NAME);
          diep = end;
          continue;
        }
@@ -3673,7 +3654,7 @@ completedieinfo (struct dieinfo *dip, struct objfile *objfile)
          diep += strlen (diep) + 1;
          break;
        default:
-         complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form);
+         unknown_attribute_form_complaint (DIE_ID, DIE_NAME, form);
          diep = end;
          break;
        }
@@ -3730,7 +3711,9 @@ target_to_host (char *from, int nbytes, int signextend,   /* FIXME:  Unused */
       rtnval = bfd_get_8 (objfile->obfd, (bfd_byte *) from);
       break;
     default:
-      complain (&no_bfd_get_N, DIE_ID, DIE_NAME, nbytes);
+      complaint (&symfile_complaints,
+                "DIE @ 0x%x \"%s\", no bfd support for %d byte data object",
+                DIE_ID, DIE_NAME, nbytes);
       rtnval = 0;
       break;
     }
@@ -3785,7 +3768,7 @@ attribute_size (unsigned int attr)
       nbytes = TARGET_FT_POINTER_SIZE (objfile);
       break;
     default:
-      complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form);
+      unknown_attribute_form_complaint (DIE_ID, DIE_NAME, form);
       nbytes = -1;
       break;
     }
This page took 0.035071 seconds and 4 git commands to generate.