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: [PATCHES, PING*5] Enhance standard DWARF for Ada


On Wed, Dec 16, 2015 at 09:53:37AM +0100, Pierre-Marie de Rodat wrote:
> On 12/11/2015 09:25 PM, Jason Merrill wrote:
> >Hmm, can we generate the DWARF procedures during finalize_size_functions
> >to avoid the need for preserve_body?
> 
> Good idea, thank you! Hereâs the updated patch (bootstrapped and regtested
> on x86_64-linux, as usual).

Unfortunately, this broke the DW_OP_GNU_implicit_pointer support, on vast
majority of binaries and libraries gcc now emits invalid DWARF (which both
gdb and dwz complain about and dwz refuses to optimize because of that).

I'm attaching two possible patches, so far untested.

The first one just fixes what I mainly care about, the committed patch
assumed that DW_TAG_dwarf_procedure is always only created for the Ada
variable sized structures or whatever it was meant for, which is not the
case, and thus if we emit DW_TAG_dwarf_procedure for some other reason,
it would be pruned as unused even when it is actually used (and result in
a DIE reference to the compilation unit header, which is always invalid).

But, looking at the points where you use DW_TAG_dwarf_procedure for the Ada
things, I can't see how it can actually work at all, though there is no
testsuite coverage, so it is hard to find out for real.
The thing is, current code sets die_perennial_p on type DIEs and their
parents, but nothing else.  In particular, type DIEs are identified by
being returned from lookup_type_die, thus earlier passed to
equate_type_number_to_die.  I don't see that this would ever be the case
of DW_TAG_dwarf_procedure though, I see the return of
function_to_dwarf_procedure being used as dw_loc_oprnd1.v.val_die_ref.die
of a DW_OP_call4 that is somewhere used in some location description that is
perhaps used somewhere in some type DIE computation.
Thus, I'm afraid for Ada variable sized structures you get the same problem,
you might IMHO DW_OP_call4 .Ldebug_info0 + 0 because the
DW_TAG_dwarf_procedure will be pruned as "unused".  So IMHO the second patch
makes more sense, and if you (for GCC 7?) want to prune really unused
DW_TAG_dwarf_procedure, you need to add code that will really walk all of
the debuginfo, rather than just type DIEs themselves, and look if location
descriptions (in .debug_info or .debug_loc) reference those
DW_TAG_dwarf_procedure and mark the DW_TAG_dwarf_procedure.

So, Pierre-Marie, can I ask you to run whatever Ada debug info testsuite
you have with the second patch?  And for GCC 7 really please consider adding
gnat.dg/guality/ and fill it with tests.

	Jakub

Attachment: V776a
Description: Text document

Attachment: V776b
Description: Text document


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