[patch] Fix debug info of nested inline functions

Jason Merrill jason@redhat.com
Fri May 18 20:02:00 GMT 2012


On 05/16/2012 05:29 PM, Eric Botcazou wrote:
> -	  if (cgraph_function_possibly_inlined_p (decl))
> +	  if (function_possibly_abstracted_p (decl))
>   	    add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_inlined);
>   	  else
>   	    add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_not_inlined);
>   	}
>         else
>   	{
> -	  if (cgraph_function_possibly_inlined_p (decl))
> +	  if (function_possibly_abstracted_p (decl))

Why do you need this change?  As long as we're setting DW_AT_inline, it 
shouldn't matter what its value is.

> -	  if (origin && origin->die_parent)
> -	    add_child_die (origin->die_parent, die);
> +	  if (origin)
> +	    {
> +	      /* 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);
> +	    }

If we are looking at the DIE for something from a function in non-unit 
scope, this will return comp_unit_die() where previously it would have 
returned the immediate scope of the function, which might be something 
like a namespace/module or type.

Jason



More information about the Gcc-patches mailing list