public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/94474] Incorrect DWARF range information for inlined function
Date: Sat, 16 May 2020 08:09:49 +0000	[thread overview]
Message-ID: <bug-94474-4-EqwuHHyZAG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94474-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94474

--- Comment #11 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Andrew,

(In reply to Andrew Burgess from comment #10)
> Further, I've seen no mention of exit views anywhere, and I think they
> would also be needed.
> 

Yes, that is also my idea, when I say the dwarf2 spec needs to
be fixed.

> With the addition of these two features we would be able to support (I
> believe) fully merged callers and callees, with lines marked as
> is-stmt from both the caller and callee appearing at the same address.
> 
> For now, without this, I think GCC needs to restrict itself when
> inlining.  When an address represents a line from both the caller and
> callee, then that address should only be is-stmt true for EITHER lines
> from the caller, or lines from the callee.  If the address is is-stmt
> true for a line from the caller, then the address should NOT be within
> the callee's range(s), and if the address is is-stmt true for a line
> from the callee, then the address MUST be within the callee's
> range(s).
> 

I tried to do something similar, in my original gcc-patch,
which was unfortunately not accepted.

But what I learned from writing the patch is that gcc cannot
easily tell if a range will be empty or not.  That is because
the assembler does emit the line info and the views,
and the assembler decides how many bytes if any a certain
construct will take in the binary representation.

That is why this empty range appears, because that was
supposed to be the start of the inline function, but
instructions from the function prologue were moved in there.
What causes the problem is the is-stmt line info which
is the only remaining thing from the original plan.
But on the other hand, it is not a big issue for gdb to
ignore those artefacts, when they rarely occur.
My gdb-patch does this, by changing the is-stmt bit of
this line info.

> On a final note.  These are just my personal thoughts from the
> perspective of a debug consumer, though I use words like "must" or
> "should" above this reflects my thoughts on how I believe the debug
> should appear, and is not an attempt to prescribe how GCC should
> be.  I know there are limitations to what GCC can achieve, and also, I
> could be totally wrong in my understanding of DWARF.  I'm always happy
> to be corrected!

Yeah, that is true for myself as well.

Ping, Alexandre Oliva, are you still with us?
I would be curious to know what you think, about this how
should we proceed?


Thanks
Bernd.

  parent reply	other threads:[~2020-05-16  8:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 16:13 [Bug debug/94474] New: " andrew.burgess at embecosm dot com
2020-04-06  9:59 ` [Bug debug/94474] " bernd.edlinger at hotmail dot de
2020-04-06 10:54 ` andrew.burgess at embecosm dot com
2020-04-06 11:04 ` bernd.edlinger at hotmail dot de
2020-04-06 11:17 ` bernd.edlinger at hotmail dot de
2020-04-06 12:55 ` andrew.burgess at embecosm dot com
2020-04-06 12:57 ` bernd.edlinger at hotmail dot de
2020-04-06 13:15 ` bernd.edlinger at hotmail dot de
2020-04-06 14:16 ` andrew.burgess at embecosm dot com
2020-04-28  2:17 ` bernd.edlinger at hotmail dot de
2020-04-28  9:56 ` andrew.burgess at embecosm dot com
2020-05-16  8:09 ` bernd.edlinger at hotmail dot de [this message]
2020-05-17  8:43 ` andrew.burgess at embecosm dot com
2020-05-17  9:05 ` bernd.edlinger at hotmail dot de
2021-12-28 13:16 ` bernd.edlinger at hotmail dot de
2021-12-28 20:57 ` bernd.edlinger at hotmail dot de

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=bug-94474-4-EqwuHHyZAG@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).