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: [debug-early] emit early dwarf for locally scoped functions


On 03/25/2015 12:37 PM, Jason Merrill wrote:
On 03/24/2015 02:00 PM, Aldy Hernandez wrote:
I found that for locally scoped functions we were not emitting early
dwarf.

Why weren't they being emitted as part of their enclosing function? They
should be.

Jason


Hmm, you're right.  Sorry for being so sloppy.

What is actually happening is that when the declaration is seen, nameless DIEs for the types are generated, which are then used when the cached subprogram DIE is seen the second time. The nameless DIEs end up looking like this because we don't have the "this" name:

    char Object_method(Object * const);

whereas the function type should be:

    char Object_method(void);

I now understand what this was doing in mainline:

	  /* Clear out the declaration attribute and the formal parameters.
	     Do not remove all children, because it is possible that this
	     declaration die was forced using force_decl_die(). In such
	     cases die that forced declaration die (e.g. TAG_imported_module)
	     is one of the children that we do not want to remove.  */
	  remove_AT (subr_die, DW_AT_declaration);
	  remove_AT (subr_die, DW_AT_object_pointer);
	  remove_child_TAG (subr_die, DW_TAG_formal_parameter);

I suppose we could re-use the DW_AT_object_pointer and DW_TAG_formal_parameter, and tack on the DW_AT_name now that we know it? Or we could cheat and just remove them as mainline does, but only when reusing a declaration (as in the attached patch).

What do you think?

Aldy

Attachment: curr
Description: Text document


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