* dwarf2read.c (create_addrmap_from_index): Ignore bad address table
[deliverable/binutils-gdb.git] / gdb / dwarf2read.c
index 9ed43b2b849d598b7fd2618f67496742f0002d05..54a6dfbdb43fd922e34d3f64865d113536d86ccc 100644 (file)
@@ -558,6 +558,16 @@ struct dwarf2_per_cu_data
      attributes in the stub.  */
   unsigned int reading_dwo_directly : 1;
 
+  /* Non-zero if the TU has been read.
+     This is used to assist the "Stay in DWO Optimization" for Fission:
+     When reading a DWO, it's faster to read TUs from the DWO instead of
+     fetching them from random other DWOs (due to comdat folding).
+     If the TU has already been read, the optimization is unnecessary
+     (and unwise - we don't want to change where gdb thinks the TU lives
+     "midflight").
+     This flag is only valid if is_debug_types is true.  */
+  unsigned int tu_read : 1;
+
   /* The section this CU/TU lives in.
      If the DIE refers to a DWO file, this is always the original die,
      not the DWO file.  */
@@ -1452,10 +1462,10 @@ static struct symbol *new_symbol (struct die_info *, struct type *,
 static struct symbol *new_symbol_full (struct die_info *, struct type *,
                                       struct dwarf2_cu *, struct symbol *);
 
-static void dwarf2_const_value (struct attribute *, struct symbol *,
+static void dwarf2_const_value (const struct attribute *, struct symbol *,
                                struct dwarf2_cu *);
 
-static void dwarf2_const_value_attr (struct attribute *attr,
+static void dwarf2_const_value_attr (const struct attribute *attr,
                                     struct type *type,
                                     const char *name,
                                     struct obstack *obstack,
@@ -1476,7 +1486,7 @@ static void set_descriptive_type (struct type *, struct die_info *,
 static struct type *die_containing_type (struct die_info *,
                                         struct dwarf2_cu *);
 
-static struct type *lookup_die_type (struct die_info *, struct attribute *,
+static struct type *lookup_die_type (struct die_info *, const struct attribute *,
                                     struct dwarf2_cu *);
 
 static struct type *read_type_die (struct die_info *, struct dwarf2_cu *);
@@ -1608,27 +1618,27 @@ static void dump_die_1 (struct ui_file *, int level, int max_level,
 static void store_in_ref_table (struct die_info *,
                                struct dwarf2_cu *);
 
-static sect_offset dwarf2_get_ref_die_offset (struct attribute *);
+static sect_offset dwarf2_get_ref_die_offset (const struct attribute *);
 
-static LONGEST dwarf2_get_attr_constant_value (struct attribute *, int);
+static LONGEST dwarf2_get_attr_constant_value (const struct attribute *, int);
 
 static struct die_info *follow_die_ref_or_sig (struct die_info *,
-                                              struct attribute *,
+                                              const struct attribute *,
                                               struct dwarf2_cu **);
 
 static struct die_info *follow_die_ref (struct die_info *,
-                                       struct attribute *,
+                                       const struct attribute *,
                                        struct dwarf2_cu **);
 
 static struct die_info *follow_die_sig (struct die_info *,
-                                       struct attribute *,
+                                       const struct attribute *,
                                        struct dwarf2_cu **);
 
 static struct type *get_signatured_type (struct die_info *, ULONGEST,
                                         struct dwarf2_cu *);
 
 static struct type *get_DW_AT_signature_type (struct die_info *,
-                                             struct attribute *,
+                                             const struct attribute *,
                                              struct dwarf2_cu *);
 
 static void load_full_type_unit (struct dwarf2_per_cu_data *per_cu);
@@ -1636,7 +1646,7 @@ static void load_full_type_unit (struct dwarf2_per_cu_data *per_cu);
 static void read_signatured_type (struct signatured_type *);
 
 static struct type_unit_group *get_type_unit_group
-    (struct dwarf2_cu *, struct attribute *);
+    (struct dwarf2_cu *, const struct attribute *);
 
 static void build_type_unit_groups (die_reader_func_ftype *, void *);
 
@@ -1659,9 +1669,9 @@ static int attr_form_is_ref (const struct attribute *);
 
 static void fill_in_loclist_baton (struct dwarf2_cu *cu,
                                   struct dwarf2_loclist_baton *baton,
-                                  struct attribute *attr);
+                                  const struct attribute *attr);
 
-static void dwarf2_symbol_mark_computed (struct attribute *attr,
+static void dwarf2_symbol_mark_computed (const struct attribute *attr,
                                         struct symbol *sym,
                                         struct dwarf2_cu *cu,
                                         int is_block);
@@ -2560,17 +2570,24 @@ create_addrmap_from_index (struct objfile *objfile, struct mapped_index *index)
       cu_index = extract_unsigned_integer (iter, 4, BFD_ENDIAN_LITTLE);
       iter += 4;
 
-      if (cu_index < dwarf2_per_objfile->n_comp_units)
+      if (lo > hi)
        {
-         addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
-                            dw2_get_cu (cu_index));
+         complaint (&symfile_complaints,
+                    _(".gdb_index address table has invalid range (%s - %s)"),
+                    pulongest (lo), pulongest (hi));
+         continue;
        }
-      else
+
+      if (cu_index >= dwarf2_per_objfile->n_comp_units)
        {
          complaint (&symfile_complaints,
                     _(".gdb_index address table has invalid CU number %u"),
                     (unsigned) cu_index);
+         continue;
        }
+
+      addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
+                        dw2_get_cu (cu_index));
     }
 
   objfile->psymtabs_addrmap = addrmap_create_fixed (mutable_map,
@@ -3435,83 +3452,6 @@ dw2_expand_symtabs_with_fullname (struct objfile *objfile,
     }
 }
 
-/* A helper function for dw2_find_symbol_file that finds the primary
-   file name for a given CU.  This is a die_reader_func.  */
-
-static void
-dw2_get_primary_filename_reader (const struct die_reader_specs *reader,
-                                const gdb_byte *info_ptr,
-                                struct die_info *comp_unit_die,
-                                int has_children,
-                                void *data)
-{
-  const char **result_ptr = data;
-  struct dwarf2_cu *cu = reader->cu;
-  struct attribute *attr;
-
-  attr = dwarf2_attr (comp_unit_die, DW_AT_name, cu);
-  if (attr == NULL)
-    *result_ptr = NULL;
-  else
-    *result_ptr = DW_STRING (attr);
-}
-
-static const char *
-dw2_find_symbol_file (struct objfile *objfile, const char *name)
-{
-  struct dwarf2_per_cu_data *per_cu;
-  offset_type *vec;
-  const char *filename;
-
-  dw2_setup (objfile);
-
-  /* index_table is NULL if OBJF_READNOW.  */
-  if (!dwarf2_per_objfile->index_table)
-    {
-      struct symtab *s;
-
-      ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
-       {
-         struct blockvector *bv = BLOCKVECTOR (s);
-         const struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-         struct symbol *sym = lookup_block_symbol (block, name, VAR_DOMAIN);
-
-         if (sym)
-           {
-             /* Only file extension of returned filename is recognized.  */
-             return SYMBOL_SYMTAB (sym)->filename;
-           }
-       }
-      return NULL;
-    }
-
-  if (!find_slot_in_mapped_hash (dwarf2_per_objfile->index_table,
-                                name, &vec))
-    return NULL;
-
-  /* Note that this just looks at the very first one named NAME -- but
-     actually we are looking for a function.  find_main_filename
-     should be rewritten so that it doesn't require a custom hook.  It
-     could just use the ordinary symbol tables.  */
-  /* vec[0] is the length, which must always be >0.  */
-  per_cu = dw2_get_cu (GDB_INDEX_CU_VALUE (MAYBE_SWAP (vec[1])));
-
-  if (per_cu->v.quick->symtab != NULL)
-    {
-      /* Only file extension of returned filename is recognized.  */
-      return per_cu->v.quick->symtab->filename;
-    }
-
-  /* Initialize filename in case there's a problem reading the DWARF,
-     dw2_get_primary_filename_reader may not get called.  */
-  filename = NULL;
-  init_cutu_and_read_dies (per_cu, NULL, 0, 0,
-                          dw2_get_primary_filename_reader, &filename);
-
-  /* Only file extension of returned filename is recognized.  */
-  return filename;
-}
-
 static void
 dw2_map_matching_symbols (const char * name, domain_enum namespace,
                          struct objfile *objfile, int global,
@@ -3835,7 +3775,6 @@ const struct quick_symbol_functions dwarf2_gdb_index_functions =
   dw2_expand_symtabs_for_function,
   dw2_expand_all_symtabs,
   dw2_expand_symtabs_with_fullname,
-  dw2_find_symbol_file,
   dw2_map_matching_symbols,
   dw2_expand_symtabs_matching,
   dw2_find_pc_sect_symtab,
@@ -4443,11 +4382,7 @@ fill_in_sig_entry_from_dwo_entry (struct objfile *objfile,
                                  struct signatured_type *sig_entry,
                                  struct dwo_unit *dwo_entry)
 {
-  sig_entry->per_cu.section = dwo_entry->section;
-  sig_entry->per_cu.offset = dwo_entry->offset;
-  sig_entry->per_cu.length = dwo_entry->length;
-  sig_entry->per_cu.reading_dwo_directly = 1;
-  sig_entry->per_cu.objfile = objfile;
+  /* Make sure we're not clobbering something we don't expect to.  */
   gdb_assert (! sig_entry->per_cu.queued);
   gdb_assert (sig_entry->per_cu.cu == NULL);
   gdb_assert (sig_entry->per_cu.v.quick != NULL);
@@ -4455,19 +4390,26 @@ fill_in_sig_entry_from_dwo_entry (struct objfile *objfile,
   gdb_assert (sig_entry->signature == dwo_entry->signature);
   gdb_assert (sig_entry->type_offset_in_section.sect_off == 0);
   gdb_assert (sig_entry->type_unit_group == NULL);
+  gdb_assert (sig_entry->dwo_unit == NULL);
+
+  sig_entry->per_cu.section = dwo_entry->section;
+  sig_entry->per_cu.offset = dwo_entry->offset;
+  sig_entry->per_cu.length = dwo_entry->length;
+  sig_entry->per_cu.reading_dwo_directly = 1;
+  sig_entry->per_cu.objfile = objfile;
   sig_entry->type_offset_in_tu = dwo_entry->type_offset_in_tu;
   sig_entry->dwo_unit = dwo_entry;
 }
 
 /* Subroutine of lookup_signatured_type.
-   Create the signatured_type data structure for a TU to be read in
-   directly from a DWO file, bypassing the stub.
-   We do this for the case where there is no DWP file and we're using
-   .gdb_index: When reading a CU we want to stay in the DWO file containing
-   that CU.  Otherwise we could end up reading several other DWO files (due
-   to comdat folding) to process the transitive closure of all the mentioned
-   TUs, and that can be slow.  The current DWO file will have every type
-   signature that it needs.
+   If we haven't read the TU yet, create the signatured_type data structure
+   for a TU to be read in directly from a DWO file, bypassing the stub.
+   This is the "Stay in DWO Optimization": When there is no DWP file and we're
+   using .gdb_index, then when reading a CU we want to stay in the DWO file
+   containing that CU.  Otherwise we could end up reading several other DWO
+   files (due to comdat folding) to process the transitive closure of all the
+   mentioned TUs, and that can be slow.  The current DWO file will have every
+   type signature that it needs.
    We only do this for .gdb_index because in the psymtab case we already have
    to read all the DWOs to build the type unit groups.  */
 
@@ -4496,8 +4438,13 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
   sig_entry = htab_find (dwarf2_per_objfile->signatured_types, &find_sig_entry);
   if (sig_entry == NULL)
     return NULL;
+
+  /* We can get here with the TU already read, *or* in the process of being
+     read.  Don't reassign it if that's the case.  Also note that if the TU is
+     already being read, it may not have come from a DWO, the program may be
+     a mix of Fission-compiled code and non-Fission-compiled code.  */
   /* Have we already tried to read this TU?  */
-  if (sig_entry->dwo_unit != NULL)
+  if (sig_entry->per_cu.tu_read)
     return sig_entry;
 
   /* Ok, this is the first time we're reading this TU.  */
@@ -5414,7 +5361,7 @@ create_type_unit_group (struct dwarf2_cu *cu, sect_offset line_offset_struct)
    STMT_LIST is a DW_AT_stmt_list attribute.  */
 
 static struct type_unit_group *
-get_type_unit_group (struct dwarf2_cu *cu, struct attribute *stmt_list)
+get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list)
 {
   struct tu_stats *tu_stats = &dwarf2_per_objfile->tu_stats;
   struct type_unit_group *tu_group;
@@ -5683,6 +5630,21 @@ create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name)
   return pst;
 }
 
+/* The DATA object passed to process_psymtab_comp_unit_reader has this
+   type.  */
+
+struct process_psymtab_comp_unit_data
+{
+  /* True if we are reading a DW_TAG_partial_unit.  */
+
+  int want_partial_unit;
+
+  /* The "pretend" language that is used if the CU doesn't declare a
+     language.  */
+
+  enum language pretend_language;
+};
+
 /* die_reader_func for process_psymtab_comp_unit.  */
 
 static void
@@ -5701,16 +5663,14 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
   struct partial_symtab *pst;
   int has_pc_info;
   const char *filename;
-  int *want_partial_unit_ptr = data;
+  struct process_psymtab_comp_unit_data *info = data;
 
-  if (comp_unit_die->tag == DW_TAG_partial_unit
-      && (want_partial_unit_ptr == NULL
-         || !*want_partial_unit_ptr))
+  if (comp_unit_die->tag == DW_TAG_partial_unit && !info->want_partial_unit)
     return;
 
   gdb_assert (! per_cu->is_debug_types);
 
-  prepare_one_comp_unit (cu, comp_unit_die, language_minimal);
+  prepare_one_comp_unit (cu, comp_unit_die, info->pretend_language);
 
   cu->list_in_scope = &file_symbols;
 
@@ -5825,8 +5785,11 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
 
 static void
 process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
-                          int want_partial_unit)
+                          int want_partial_unit,
+                          enum language pretend_language)
 {
+  struct process_psymtab_comp_unit_data info;
+
   /* If this compilation unit was already read in, free the
      cached copy in order to read it in again. This is
      necessary because we skipped some symbols when we first
@@ -5836,9 +5799,11 @@ process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
     free_one_cached_comp_unit (this_cu);
 
   gdb_assert (! this_cu->is_debug_types);
+  info.want_partial_unit = want_partial_unit;
+  info.pretend_language = pretend_language;
   init_cutu_and_read_dies (this_cu, NULL, 0, 0,
                           process_psymtab_comp_unit_reader,
-                          &want_partial_unit);
+                          &info);
 
   /* Age out any secondary CUs.  */
   age_cached_comp_units ();
@@ -6016,7 +5981,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
     {
       struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
 
-      process_psymtab_comp_unit (per_cu, 0);
+      process_psymtab_comp_unit (per_cu, 0, language_minimal);
     }
 
   set_partial_user (objfile);
@@ -6238,7 +6203,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
 
                /* Go read the partial unit, if needed.  */
                if (per_cu->v.psymtab == NULL)
-                 process_psymtab_comp_unit (per_cu, 1);
+                 process_psymtab_comp_unit (per_cu, 1, cu->language);
 
                VEC_safe_push (dwarf2_per_cu_ptr,
                               cu->per_cu->imported_symtabs, per_cu);
@@ -7028,14 +6993,21 @@ process_queue (void)
          : (item->per_cu->v.psymtab && !item->per_cu->v.psymtab->readin))
        {
          struct dwarf2_per_cu_data *per_cu = item->per_cu;
+         char buf[100];
 
-         if (dwarf2_read_debug)
+         if (per_cu->is_debug_types)
            {
-             fprintf_unfiltered (gdb_stdlog,
-                                 "Expanding symtab of %s at offset 0x%x\n",
-                                 per_cu->is_debug_types ? "TU" : "CU",
-                                 per_cu->offset.sect_off);
+             struct signatured_type *sig_type =
+               (struct signatured_type *) per_cu;
+
+             sprintf (buf, "TU %s at offset 0x%x",
+                      hex_string (sig_type->signature), per_cu->offset.sect_off);
            }
+         else
+           sprintf (buf, "CU at offset 0x%x", per_cu->offset.sect_off);
+
+         if (dwarf2_read_debug)
+           fprintf_unfiltered (gdb_stdlog, "Expanding symtab of %s\n", buf);
 
          if (per_cu->is_debug_types)
            process_full_type_unit (per_cu, item->pretend_language);
@@ -7043,12 +7015,7 @@ process_queue (void)
            process_full_comp_unit (per_cu, item->pretend_language);
 
          if (dwarf2_read_debug)
-           {
-             fprintf_unfiltered (gdb_stdlog,
-                                 "Done expanding %s at offset 0x%x\n",
-                                 per_cu->is_debug_types ? "TU" : "CU",
-                                 per_cu->offset.sect_off);
-           }
+           fprintf_unfiltered (gdb_stdlog, "Done expanding %s\n", buf);
        }
 
       item->per_cu->queued = 0;
@@ -7352,12 +7319,14 @@ get_symtab (struct dwarf2_per_cu_data *per_cu)
    included by PER_CU.  */
 
 static void
-recursively_compute_inclusions (VEC (dwarf2_per_cu_ptr) **result,
-                               htab_t all_children,
-                               struct dwarf2_per_cu_data *per_cu)
+recursively_compute_inclusions (VEC (symtab_ptr) **result,
+                               htab_t all_children, htab_t all_type_symtabs,
+                               struct dwarf2_per_cu_data *per_cu,
+                               struct symtab *immediate_parent)
 {
   void **slot;
   int ix;
+  struct symtab *symtab;
   struct dwarf2_per_cu_data *iter;
 
   slot = htab_find_slot (all_children, per_cu, INSERT);
@@ -7369,13 +7338,37 @@ recursively_compute_inclusions (VEC (dwarf2_per_cu_ptr) **result,
 
   *slot = per_cu;
   /* Only add a CU if it has a symbol table.  */
-  if (get_symtab (per_cu) != NULL)
-    VEC_safe_push (dwarf2_per_cu_ptr, *result, per_cu);
+  symtab = get_symtab (per_cu);
+  if (symtab != NULL)
+    {
+      /* If this is a type unit only add its symbol table if we haven't
+        seen it yet (type unit per_cu's can share symtabs).  */
+      if (per_cu->is_debug_types)
+       {
+         slot = htab_find_slot (all_type_symtabs, symtab, INSERT);
+         if (*slot == NULL)
+           {
+             *slot = symtab;
+             VEC_safe_push (symtab_ptr, *result, symtab);
+             if (symtab->user == NULL)
+               symtab->user = immediate_parent;
+           }
+       }
+      else
+       {
+         VEC_safe_push (symtab_ptr, *result, symtab);
+         if (symtab->user == NULL)
+           symtab->user = immediate_parent;
+       }
+    }
 
   for (ix = 0;
        VEC_iterate (dwarf2_per_cu_ptr, per_cu->imported_symtabs, ix, iter);
        ++ix)
-    recursively_compute_inclusions (result, all_children, iter);
+    {
+      recursively_compute_inclusions (result, all_children,
+                                     all_type_symtabs, iter, symtab);
+    }
 }
 
 /* Compute the symtab 'includes' fields for the symtab related to
@@ -7389,9 +7382,10 @@ compute_symtab_includes (struct dwarf2_per_cu_data *per_cu)
   if (!VEC_empty (dwarf2_per_cu_ptr, per_cu->imported_symtabs))
     {
       int ix, len;
-      struct dwarf2_per_cu_data *iter;
-      VEC (dwarf2_per_cu_ptr) *result_children = NULL;
-      htab_t all_children;
+      struct dwarf2_per_cu_data *per_cu_iter;
+      struct symtab *symtab_iter;
+      VEC (symtab_ptr) *result_symtabs = NULL;
+      htab_t all_children, all_type_symtabs;
       struct symtab *symtab = get_symtab (per_cu);
 
       /* If we don't have a symtab, we can just skip this case.  */
@@ -7400,28 +7394,33 @@ compute_symtab_includes (struct dwarf2_per_cu_data *per_cu)
 
       all_children = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
                                        NULL, xcalloc, xfree);
+      all_type_symtabs = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
+                                           NULL, xcalloc, xfree);
 
       for (ix = 0;
           VEC_iterate (dwarf2_per_cu_ptr, per_cu->imported_symtabs,
-                       ix, iter);
+                       ix, per_cu_iter);
           ++ix)
-       recursively_compute_inclusions (&result_children, all_children, iter);
+       {
+         recursively_compute_inclusions (&result_symtabs, all_children,
+                                         all_type_symtabs, per_cu_iter,
+                                         symtab);
+       }
 
-      /* Now we have a transitive closure of all the included CUs, and
-        for .gdb_index version 7 the included TUs, so we can convert it
-        to a list of symtabs.  */
-      len = VEC_length (dwarf2_per_cu_ptr, result_children);
+      /* Now we have a transitive closure of all the included symtabs.  */
+      len = VEC_length (symtab_ptr, result_symtabs);
       symtab->includes
        = obstack_alloc (&dwarf2_per_objfile->objfile->objfile_obstack,
                         (len + 1) * sizeof (struct symtab *));
       for (ix = 0;
-          VEC_iterate (dwarf2_per_cu_ptr, result_children, ix, iter);
+          VEC_iterate (symtab_ptr, result_symtabs, ix, symtab_iter);
           ++ix)
-       symtab->includes[ix] = get_symtab (iter);
+       symtab->includes[ix] = symtab_iter;
       symtab->includes[len] = NULL;
 
-      VEC_free (dwarf2_per_cu_ptr, result_children);
+      VEC_free (symtab_ptr, result_symtabs);
       htab_delete (all_children);
+      htab_delete (all_type_symtabs);
     }
 }
 
@@ -16786,7 +16785,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
    because that is the interpretation long in use by GCC.  */
 
 static gdb_byte *
-dwarf2_const_value_data (struct attribute *attr, struct obstack *obstack,
+dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack,
                         struct dwarf2_cu *cu, LONGEST *value, int bits)
 {
   struct objfile *objfile = cu->objfile;
@@ -16818,7 +16817,7 @@ dwarf2_const_value_data (struct attribute *attr, struct obstack *obstack,
    expression.  */
 
 static void
-dwarf2_const_value_attr (struct attribute *attr, struct type *type,
+dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
                         const char *name, struct obstack *obstack,
                         struct dwarf2_cu *cu,
                         LONGEST *value, const gdb_byte **bytes,
@@ -16921,7 +16920,7 @@ dwarf2_const_value_attr (struct attribute *attr, struct type *type,
 /* Copy constant value from an attribute to a symbol.  */
 
 static void
-dwarf2_const_value (struct attribute *attr, struct symbol *sym,
+dwarf2_const_value (const struct attribute *attr, struct symbol *sym,
                    struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
@@ -17060,7 +17059,7 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die)
    If there is no type substitute an error marker.  */
 
 static struct type *
-lookup_die_type (struct die_info *die, struct attribute *attr,
+lookup_die_type (struct die_info *die, const struct attribute *attr,
                 struct dwarf2_cu *cu)
 {
   struct objfile *objfile = cu->objfile;
@@ -17956,7 +17955,7 @@ store_in_ref_table (struct die_info *die, struct dwarf2_cu *cu)
    required kind.  */
 
 static sect_offset
-dwarf2_get_ref_die_offset (struct attribute *attr)
+dwarf2_get_ref_die_offset (const struct attribute *attr)
 {
   sect_offset retval = { DW_UNSND (attr) };
 
@@ -17974,7 +17973,7 @@ dwarf2_get_ref_die_offset (struct attribute *attr)
  * the value held by the attribute is not constant.  */
 
 static LONGEST
-dwarf2_get_attr_constant_value (struct attribute *attr, int default_value)
+dwarf2_get_attr_constant_value (const struct attribute *attr, int default_value)
 {
   if (attr->form == DW_FORM_sdata)
     return DW_SND (attr);
@@ -17998,7 +17997,7 @@ dwarf2_get_attr_constant_value (struct attribute *attr, int default_value)
    On exit *REF_CU is the CU of the result.  */
 
 static struct die_info *
-follow_die_ref_or_sig (struct die_info *src_die, struct attribute *attr,
+follow_die_ref_or_sig (struct die_info *src_die, const struct attribute *attr,
                       struct dwarf2_cu **ref_cu)
 {
   struct die_info *die;
@@ -18072,7 +18071,7 @@ follow_die_offset (sect_offset offset, int offset_in_dwz,
    On exit *REF_CU is the CU of the result.  */
 
 static struct die_info *
-follow_die_ref (struct die_info *src_die, struct attribute *attr,
+follow_die_ref (struct die_info *src_die, const struct attribute *attr,
                struct dwarf2_cu **ref_cu)
 {
   sect_offset offset = dwarf2_get_ref_die_offset (attr);
@@ -18384,7 +18383,7 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
    If the referenced type cannot be found an error is thrown.  */
 
 static struct die_info *
-follow_die_sig (struct die_info *src_die, struct attribute *attr,
+follow_die_sig (struct die_info *src_die, const struct attribute *attr,
                struct dwarf2_cu **ref_cu)
 {
   ULONGEST signature = DW_SIGNATURE (attr);
@@ -18482,7 +18481,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
    reading in and processing the type unit if necessary.  */
 
 static struct type *
-get_DW_AT_signature_type (struct die_info *die, struct attribute *attr,
+get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr,
                          struct dwarf2_cu *cu) /* ARI: editCase function */
 {
   /* Yes, DW_AT_signature can use a non-ref_sig8 reference.  */
@@ -18582,6 +18581,7 @@ read_signatured_type (struct signatured_type *sig_type)
 
   init_cutu_and_read_dies (per_cu, NULL, 0, 1,
                           read_signatured_type_reader, NULL);
+  sig_type->per_cu.tu_read = 1;
 }
 
 /* Decode simple location descriptions.
@@ -19892,7 +19892,7 @@ cu_debug_loc_section (struct dwarf2_cu *cu)
 static void
 fill_in_loclist_baton (struct dwarf2_cu *cu,
                       struct dwarf2_loclist_baton *baton,
-                      struct attribute *attr)
+                      const struct attribute *attr)
 {
   struct dwarf2_section_info *section = cu_debug_loc_section (cu);
 
@@ -19909,7 +19909,7 @@ fill_in_loclist_baton (struct dwarf2_cu *cu,
 }
 
 static void
-dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
+dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
                             struct dwarf2_cu *cu, int is_block)
 {
   struct objfile *objfile = dwarf2_per_objfile->objfile;
This page took 0.039882 seconds and 4 git commands to generate.