This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

DWARF2 patch to gen_subprogram_die


In some cases, we try to reuse the DIE for a class-level declaration of a
function to also provide debug info for the definition.  Before this patch,
we did so for functions defined inside the class, but that turns out to
violate the dwarf2 spec.  We now only do so for local class methods.

The old behavior also caused problems with -feliminate-dwarf2-dups on the
C++ testsuite under some circumstances that I've forgotten over the several
months that this has been sitting in my source tree.

2001-01-19  Jason Merrill  <jason@redhat.com>

	* dwarf2out.c (gen_subprogram_die): Don't reuse the in-class decl
	for the abstract instance of an inline function.

*** dwarf2out.c.~1~	Fri Jan 19 14:22:40 2001
--- dwarf2out.c	Fri Jan 19 14:22:48 2001
*************** gen_subprogram_die (decl, context_die)
*** 9868,9879 ****
        /* If the definition comes from the same place as the declaration,
  	 maybe use the old DIE.  We always want the DIE for this function
  	 that has the *_pc attributes to be under comp_unit_die so the
! 	 debugger can find it.  For inlines, that is the concrete instance,
! 	 so we can use the old DIE here.  For non-inline methods, we want a
! 	 specification DIE at toplevel, so we need a new DIE.  For local
! 	 class methods, this doesn't apply; we just use the old DIE.  */
!       if ((DECL_ABSTRACT (decl) || old_die->die_parent == comp_unit_die
! 	   || context_die == NULL)
  	  && (DECL_ARTIFICIAL (decl)
  	      || (get_AT_unsigned (old_die, DW_AT_decl_file) == file_index
  		  && (get_AT_unsigned (old_die, DW_AT_decl_line)
--- 9868,9878 ----
        /* If the definition comes from the same place as the declaration,
  	 maybe use the old DIE.  We always want the DIE for this function
  	 that has the *_pc attributes to be under comp_unit_die so the
! 	 debugger can find it.  We also need to do this for abstract
! 	 instances of inlines, since the spec requires the out-of-line copy
! 	 to have the same parent.  For local class methods, this doesn't
! 	 apply; we just use the old DIE.  */
!       if ((old_die->die_parent == comp_unit_die || context_die == NULL)
  	  && (DECL_ARTIFICIAL (decl)
  	      || (get_AT_unsigned (old_die, DW_AT_decl_file) == file_index
  		  && (get_AT_unsigned (old_die, DW_AT_decl_line)

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