remove unused qf method
[deliverable/binutils-gdb.git] / gdb / dwarf2read.c
index cb77386f6f29bd0d5c9046d8fef209dfc582375a..13cd12fb341861cbabcd31d27d465756c93a04cd 100644 (file)
@@ -3445,83 +3445,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,
@@ -3845,7 +3768,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,
@@ -7374,7 +7296,8 @@ get_symtab (struct dwarf2_per_cu_data *per_cu)
 static void
 recursively_compute_inclusions (VEC (symtab_ptr) **result,
                                htab_t all_children, htab_t all_type_symtabs,
-                               struct dwarf2_per_cu_data *per_cu)
+                               struct dwarf2_per_cu_data *per_cu,
+                               struct symtab *immediate_parent)
 {
   void **slot;
   int ix;
@@ -7402,10 +7325,16 @@ recursively_compute_inclusions (VEC (symtab_ptr) **result,
            {
              *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);
+       {
+         VEC_safe_push (symtab_ptr, *result, symtab);
+         if (symtab->user == NULL)
+           symtab->user = immediate_parent;
+       }
     }
 
   for (ix = 0;
@@ -7413,7 +7342,7 @@ recursively_compute_inclusions (VEC (symtab_ptr) **result,
        ++ix)
     {
       recursively_compute_inclusions (result, all_children,
-                                     all_type_symtabs, iter);
+                                     all_type_symtabs, iter, symtab);
     }
 }
 
@@ -7449,7 +7378,8 @@ compute_symtab_includes (struct dwarf2_per_cu_data *per_cu)
           ++ix)
        {
          recursively_compute_inclusions (&result_symtabs, all_children,
-                                         all_type_symtabs, per_cu_iter);
+                                         all_type_symtabs, per_cu_iter,
+                                         symtab);
        }
 
       /* Now we have a transitive closure of all the included symtabs.  */
This page took 0.029938 seconds and 4 git commands to generate.