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]
Other format: [Raw text]

Re: [patch] Fix debug info of nested inline functions


On 03/02/2012 03:29 PM, Eric Botcazou wrote:

I notice that D.7 seems to suggest that if the nested function is not inlinable and shared between all instances of the containing function that we put a normal (non-abstract/concrete) instance of the nested function inside the abstract function for the containing function. But I agree that it's cleaner your way: put an abstract instance there instead so that the abstract instance of the containing function is all abstract.

+  /* Emit an abstract instance of nested functions within an abstract instance
+     of their parent.  */
+  int declaration = ((decl != current_function_decl
+		      && !(DECL_INITIAL (decl) != NULL_TREE
+			   && DECL_ABSTRACT (decl)
+			   && current_function_decl
+			   && DECL_ABSTRACT (current_function_decl)))
 		     || class_or_namespace_scope_p (context_die));

Hmm, why isn't current_function_decl == decl when we're trying to emit the abstract instance of a nested function?


+  /* Do not emit concrete instances of abstracted nested functions without
+     actual instances.  */
+  else if (TREE_CODE (decl_or_origin) == FUNCTION_DECL
+	   && die
+	   && get_AT (die, DW_AT_inline))
+    ;

Should "without actual instances" be something like "within concrete instances of containing functions"?


-	  if (origin && origin->die_parent)
+	  if (origin
+	      && origin->die_parent
+	      /* Skip an abtract parent instance.  */
+	      && !(origin->die_parent->die_tag == DW_TAG_subprogram
+		   && get_AT (origin->die_parent, DW_AT_inline)))
 	    add_child_die (origin->die_parent, die);

What if the immediate parent is a DW_TAG_lexical_block or some other thing nested inside an abstract subprogram?


and you suggested to iterate over DECL_CONTEXT instead of die_parent to find an
appropriate parent in order to attach the DIE on the limbo list to.

In my earlier comments I seem to have been wrong about the behavior of gen_subprogram_die; now I see that if there is an abstract instance the concrete out-of-line instance is not associated with the decl number. So I guess your earlier limbo handling code was fine apart from the lexical_block issue above.


Jason


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