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 ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
Date: Sat, 24 Jul 2021 07:43:08 +0000	[thread overview]
Message-ID: <bug-101575-4-OaAtV4edsz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101575-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Eric Botcazou from comment #10)
> > I can of course make the .loc go away. If you really want that.
> > 
> > It is basically the DECL_SOURCE_LOCATION of an
> > otherwise ignored decl.  If the DECL_SOURCE_LOCATION
> > is UNKNOWN_LOCATION the function should have no line info,
> > and gdb should be able not to step into this function.
> 
> But that's not the original design, which is that a DECL_IGNORED_P function
> does not have .loc directives, like any other debugging information.

Yes, indeed.

DECL_IGNORED_P functions do also not have a block-structure and
many other sophisticated features like variable locations.
That does not change.

The intended change is just that if a DECL_SOURCE_LOCATION
is available it is shown in the debugger, and if there is no
DECL_SOURCE_LOCATION, really no line number shall be shown.

The motivation for this patch is the following:
Unfortunately some non-DECL_IGNORED_P functions decay
to DECL_IGNORED_P as shown in PR97937. While the test case
there is written in "C", it is certainly also an issue for Ada.

All that is left over from the original debug info is the
DECL_SOURCE_LOCATION.  Therefore the desire to at least show
this source location, because previously a completely wrong
line info from the preceding function was shown.

And on the other hand, we have DECL_IGNORED_P functions that
do not have any DECL_SOURCE_LOCATION right from the beginning.

Therefore the patch does a lot to prevent line number info
from the previous functions to extend to the following function
where it will be misleading.

But it will need some adjustments to also address DECL_IGNORED_P
functions directly at the beginning of the CU, when dwarf-4 is
used as in this PR.

  parent reply	other threads:[~2021-07-24  7:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  9:37 [Bug debug/101575] New: " vries at gcc dot gnu.org
2021-07-22 12:30 ` [Bug debug/101575] " ebotcazou at gcc dot gnu.org
2021-07-22 12:32 ` vries at gcc dot gnu.org
2021-07-22 12:54 ` [Bug ada/101575] " ebotcazou at gcc dot gnu.org
2021-07-22 13:32 ` bernd.edlinger at hotmail dot de
2021-07-22 15:57 ` vries at gcc dot gnu.org
2021-07-22 16:00 ` vries at gcc dot gnu.org
2021-07-22 16:53 ` ebotcazou at gcc dot gnu.org
2021-07-23 12:22 ` bernd.edlinger at hotmail dot de
2021-07-23 12:36 ` vries at gcc dot gnu.org
2021-07-23 15:14 ` ebotcazou at gcc dot gnu.org
2021-07-24  7:43 ` bernd.edlinger at hotmail dot de [this message]
2021-07-24 11:21 ` bernd.edlinger at hotmail dot de
2021-07-24 12:24 ` ebotcazou at gcc dot gnu.org
2021-08-04 14:19 ` cvs-commit at gcc dot gnu.org

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-101575-4-OaAtV4edsz@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).