Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Simon Marchi <simark@simark.ca>, Yao Qi <qiyaoltc@gmail.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Show optimized out local variables in "info locals"
Date: Wed, 22 Nov 2017 20:58:00 -0000	[thread overview]
Message-ID: <542fe4ae-3988-ac31-d901-e4eeb112779a@ericsson.com> (raw)
In-Reply-To: <434ca326-5bf7-562c-7445-66b265caf300@simark.ca>

On 2017-11-14 11:54 PM, Simon Marchi wrote:
> 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
> 

I've updated the thread on dwarf-discuss, and pushed the patch.

Thanks,

Simon


      reply	other threads:[~2017-11-22 20:58 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
2017-11-22 20:58     ` Simon Marchi [this message]

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=542fe4ae-3988-ac31-d901-e4eeb112779a@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    --cc=simark@simark.ca \
    /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