This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Remove type-unit processing for file name searches


Hi.

If we can rely on the line table in CUs specifying every file,
including those for type units, then there is no need to scan TUs here.
The spec is being clarified to make this so.

I plan on checking this in.
Regression tested with dwarf4+index, with/without Fission.


2013-01-16  Doug Evans  <dje@google.com>

	* dwarf2read.c (dw2_build_type_unit_groups_reader): Delete.
	(dw2_build_type_unit_groups): Delete.  All uses updated.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.731
diff -u -p -r1.731 dwarf2read.c
--- dwarf2read.c	15 Jan 2013 21:32:36 -0000	1.731
+++ dwarf2read.c	17 Jan 2013 06:55:37 -0000
@@ -2814,40 +2814,6 @@ dw2_setup (struct objfile *objfile)
   gdb_assert (dwarf2_per_objfile);
 }
 
-/* Reader function for dw2_build_type_unit_groups.  */
-
-static void
-dw2_build_type_unit_groups_reader (const struct die_reader_specs *reader,
-				   gdb_byte *info_ptr,
-				   struct die_info *type_unit_die,
-				   int has_children,
-				   void *data)
-{
-  struct dwarf2_cu *cu = reader->cu;
-  struct attribute *attr;
-  struct type_unit_group *tu_group;
-
-  gdb_assert (data == NULL);
-
-  if (! has_children)
-    return;
-
-  attr = dwarf2_attr_no_follow (type_unit_die, DW_AT_stmt_list);
-  /* Call this for its side-effect of creating the associated
-     struct type_unit_group if it doesn't already exist.  */
-  tu_group = get_type_unit_group (cu, attr);
-}
-
-/* Build dwarf2_per_objfile->type_unit_groups.
-   This function may be called multiple times.  */
-
-static void
-dw2_build_type_unit_groups (void)
-{
-  if (dwarf2_per_objfile->type_unit_groups == NULL)
-    build_type_unit_groups (dw2_build_type_unit_groups_reader, NULL);
-}
-
 /* die_reader_func for dw2_get_file_names.  */
 
 static void
@@ -3072,10 +3038,10 @@ dw2_map_symtabs_matching_filename (struc
 
   dw2_setup (objfile);
 
-  dw2_build_type_unit_groups ();
+  /* The rule is CUs specify all the files, including those used by
+     any TU, so there's no need to scan TUs here.  */
 
-  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
-		   + dwarf2_per_objfile->n_type_unit_groups); ++i)
+  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
     {
       int j;
       struct dwarf2_per_cu_data *per_cu = dw2_get_primary_cu (i);
@@ -3528,8 +3494,6 @@ dw2_expand_symtabs_matching
       struct cleanup *cleanup;
       htab_t visited_found, visited_not_found;
 
-      dw2_build_type_unit_groups ();
-
       visited_found = htab_create_alloc (10,
 					 htab_hash_pointer, htab_eq_pointer,
 					 NULL, xcalloc, xfree);
@@ -3539,8 +3503,10 @@ dw2_expand_symtabs_matching
 					     NULL, xcalloc, xfree);
       make_cleanup_htab_delete (visited_not_found);
 
-      for (i = 0; i < (dwarf2_per_objfile->n_comp_units
-		       + dwarf2_per_objfile->n_type_unit_groups); ++i)
+      /* The rule is CUs specify all the files, including those used by
+	 any TU, so there's no need to scan TUs here.  */
+
+      for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
 	{
 	  int j;
 	  struct dwarf2_per_cu_data *per_cu = dw2_get_primary_cu (i);
@@ -3713,11 +3679,11 @@ dw2_map_symbol_filenames (struct objfile
   cleanup = make_cleanup_htab_delete (visited);
   dw2_setup (objfile);
 
-  dw2_build_type_unit_groups ();
+  /* The rule is CUs specify all the files, including those used by
+     any TU, so there's no need to scan TUs here.
+     We can ignore file names coming from already-expanded CUs.  */
 
-  /* We can ignore file names coming from already-expanded CUs.  */
-  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
-		   + dwarf2_per_objfile->n_type_units); ++i)
+  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
     {
       struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
 
@@ -3730,8 +3696,7 @@ dw2_map_symbol_filenames (struct objfile
 	}
     }
 
-  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
-		   + dwarf2_per_objfile->n_type_unit_groups); ++i)
+  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
     {
       int j;
       struct dwarf2_per_cu_data *per_cu = dw2_get_primary_cu (i);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]