dwarf2out patch for incomplete types

Jason Merrill jason@cygnus.com
Thu Jun 3 02:31:00 GMT 1999


If we never deal with a type directly, only through pointers, we will never
get another chance to write out the debugging info for the class, because
we have marked the pointer type TREE_ASM_WRITTEN.  So remember what classes
we hope to see more from.

Checked in on the mainline and on the branch.

Thu Jun  3 02:15:07 1999  Jason Merrill  <jason@yorick.cygnus.com>

	* dwarf2out.c (add_incomplete_type): New fn.
	(gen_struct_or_union_type_die): Call it.
	(retry_incomplete_types): New fn.
	(dwarf2out_finish): Call it.

Index: dwarf2out.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/dwarf2out.c,v
retrieving revision 1.91
diff -c -p -r1.91 dwarf2out.c
*** dwarf2out.c	1999/04/18 13:09:25	1.91
--- dwarf2out.c	1999/06/03 09:24:14
*************** static unsigned pending_types;
*** 2426,2431 ****
--- 2426,2447 ----
     be enough for most typical programs.	 */
  #define PENDING_TYPES_INCREMENT 64
  
+ /* A pointer to the base of a list of incomplete types which might be
+    completed at some later time.  */
+ 
+ static tree *incomplete_types_list;
+ 
+ /* Number of elements currently allocated for the incomplete_types_list.  */
+ static unsigned incomplete_types_allocated;
+ 
+ /* Number of elements of incomplete_types_list currently in use.  */
+ static unsigned incomplete_types;
+ 
+ /* Size (in elements) of increments by which we may expand the incomplete
+    types list.  Actually, a single hunk of space of this size should
+    be enough for most typical programs.	 */
+ #define INCOMPLETE_TYPES_INCREMENT 64
+ 
  /* Record whether the function being analyzed contains inlined functions.  */
  static int current_function_has_inlines;
  #if 0 && defined (MIPS_DEBUGGING_INFO)
*************** output_pending_types_for_scope (context_
*** 8033,8038 ****
--- 8049,8087 ----
      }
  }
  
+ /* Remember a type in the incomplete_types_list.  */
+ 
+ static void
+ add_incomplete_type (type)
+      tree type;
+ {
+   if (incomplete_types == incomplete_types_allocated)
+     {
+       incomplete_types_allocated += INCOMPLETE_TYPES_INCREMENT;
+       incomplete_types_list
+ 	= (tree *) xrealloc (incomplete_types_list,
+ 			     sizeof (tree) * incomplete_types_allocated);
+     }
+ 
+   incomplete_types_list[incomplete_types++] = type;
+ }
+ 
+ /* Walk through the list of incomplete types again, trying once more to
+    emit full debugging info for them.  */
+ 
+ static void
+ retry_incomplete_types ()
+ {
+   register tree type;
+ 
+   while (incomplete_types)
+     {
+       --incomplete_types;
+       type = incomplete_types_list[incomplete_types];
+       gen_type_die (type, comp_unit_die);
+     }
+ }
+ 
  /* Generate a DIE to represent an inlined instance of an enumeration type.  */
  
  static void
*************** gen_struct_or_union_type_die (type, cont
*** 9024,9030 ****
  	}
      }
    else
!     add_AT_flag (type_die, DW_AT_declaration, 1);
  }
  
  /* Generate a DIE for a subroutine _type_.  */
--- 9073,9082 ----
  	}
      }
    else
!     {
!       add_AT_flag (type_die, DW_AT_declaration, 1);
!       add_incomplete_type (type);
!     }
  }
  
  /* Generate a DIE for a subroutine _type_.  */
*************** dwarf2out_finish ()
*** 9992,9997 ****
--- 10044,10053 ----
  	}
        free (node);
      }
+ 
+   /* Walk through the list of incomplete types again, trying once more to
+      emit full debugging info for them.  */
+   retry_incomplete_types ();
  
    /* Traverse the DIE tree and add sibling attributes to those DIE's
       that have children.  */


More information about the Gcc-patches mailing list