From: Simon Marchi <simark@simark.ca>
To: Yao Qi <qiyaoltc@gmail.com>, Simon Marchi <simon.marchi@ericsson.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Show optimized out local variables in "info locals"
Date: Wed, 15 Nov 2017 04:54:00 -0000 [thread overview]
Message-ID: <434ca326-5bf7-562c-7445-66b265caf300@simark.ca> (raw)
In-Reply-To: <CAH=s-PN-d3Dg0VRWZMQGrQ8D8owF_eii=X4JrOPnRVS7=JkVfQ@mail.gmail.com>
On 2017-11-14 05:44 PM, Yao Qi wrote:
> On Tue, Nov 14, 2017 at 5:08 PM, Simon Marchi <simon.marchi@ericsson.com> wrote:
>>
>> However, this change reveals what I think is a bug in GDB, see:
>>
>> http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2017-September/004394.html
>>
>
> IMO, it is not necessary to emit DW_TAG_lexical_block in concrete instances.
> See comment #4 in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37801
> At least, looks gcc generates unnecessary debug information, and we need
> to fix GCC somehow.
>
> Whether it is a bug in GDB or not, I don't know. The answer depends on it is
> *unnecessary* or *wrong* to have DW_TAG_lexical_block in concrete instances.
I had an email discussion with some gcc developers (Nathan Sidwell, Richard Biener,
Jason Merill) after a chat on IRC. Unfortunately, they answered privately so it's
not on dwarf-discuss. I'll try to update the thread on dwarf-discuss with their
answers tomorrow, for future reference. But the gist of it was:
Richard said:
> I think the lexical block is just the function scope itself and the inliner
> inserts this BLOCK which then corresponds to the DW_TAG_inlined_subroutine.
> I suppose we should avoid emitting that BLOCK itself as a DW_TAG_lexical_block
> but use the emitted DW_TAG_inlined_subroutine for that.
>
> Not sure if I remember the details correctly.
>
> I don't think the DWARF is invalid btw, with early LTO debug we have plenty of
> abstract origins where source and destination context don't match 1:1. We're
> just using it as a "get some more info from this DIE" link which I think is
> all that is documented as semantics (though the 'inline' term pops up too
> often there and the relation to DW_AT_specification is unclear to me though
> the latter is restricted to DW_TAG_subroutine AFAIR).
Jason said (replying to Richard):
>> I think the lexical block is just the function scope itself and the inliner
>> inserts this BLOCK which then corresponds to the DW_TAG_inlined_subroutine.
>> I suppose we should avoid emitting that BLOCK itself as a DW_TAG_lexical_block
>> but use the emitted DW_TAG_inlined_subroutine for that.
>
> Agreed. It's curious that we would generate the lexical block in the
> inlined instance and not the abstract.
>
>> I don't think the DWARF is invalid btw, with early LTO debug we have plenty of
>> abstract origins where source and destination context don't match 1:1. We're
>> just using it as a "get some more info from this DIE" link which I think is
>> all that is documented as semantics (though the 'inline' term pops up too
>> often there and the relation to DW_AT_specification is unclear to me though
>> the latter is restricted to DW_TAG_subroutine AFAIR).
>
> Also agreed, GDB ought to be able to handle this situation.
>
> So, bugs on both sides...
So even though there might be something to fix in GCC, I think we'll have to handle
the current case in GDB as well.
Simon
next prev parent reply other threads:[~2017-11-15 4:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-14 17:08 Simon Marchi
2017-11-14 22:44 ` Yao Qi
2017-11-15 4:54 ` Simon Marchi [this message]
2017-11-22 20:58 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=434ca326-5bf7-562c-7445-66b265caf300@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
--cc=simon.marchi@ericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox