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 09/10/2010 11:54 AM, Eric Botcazou wrote:
We can test the flag on both DECLs to match the comment:

   /* 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));

OK. I would expect DECL_ABSTRACT (current_function_decl) to be set whenever DECL_ABSTRACT (decl) is set, but I guess it doesn't hurt to check both.


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

This seems wrong. We do want to emit concrete instances of abstracted nested functions, just not within the abstract instance of the enclosing function.

This hunk is necessary to prevent abstracted nested functions from being emitted twice in the enclosing function if they are inlined there, as a concrete inline and as a concrete out-of-line instance. We wait until after actual instances, either inline or out-of-line, are encountered and attach the DIEs in dwarf2out_finish.

OK, I see.


  	if (origin)
-	    add_child_die (origin->die_parent, die);
+	    {
+	      /* Find the first non-abstract parent instance.  */
+	      do
+		origin = origin->die_parent;
+	      while (origin
+		&&  (origin->die_tag != DW_TAG_subprogram
+			 || get_AT (origin, DW_AT_inline)));
+	      if (origin)
+		add_child_die (origin, die);
+	      else
+		add_child_die (comp_unit_die, die);
+	    }

Here, shouldn't the parent of the concrete instance of the nested function be the concrete instance of the enclosing function?

Yes, the not always fulfilled 4. I mentioned in the message. How would you do that? If you look up the DIE of the enclosing function, you get the abstract instance. The parent of concrete instances doesn't seem to really matter to GDB as long as it isn't abstract.

It seems like the later block that checks DECL_CONTEXT (node->created_for) should handle the case of a concrete non-inlined instance.


Jason


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