public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Justin Paston-Cooper <paston.cooper@gmail.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	       GCC Development <gcc@gcc.gnu.org>
Subject: Re: Indicating function exit points in debug data
Date: Wed, 20 Mar 2019 17:36:00 -0000	[thread overview]
Message-ID: <20190320173633.GB3969@gate.crashing.org> (raw)
In-Reply-To: <CAEndGgR69E7Qa6jf+V9TezQVmKB3+Cu2wUZKpuPc2BiQ-Gqqig@mail.gmail.com>

On Wed, Mar 20, 2019 at 10:13:23AM +0000, Justin Paston-Cooper wrote:
> Section 6.2.5.2 outlines the line number information state machine's
> opcodes. One of them is "DW_LNS_set_epilogue_begin". Its definition
> is:
> 
> -----
> The DW_LNS_set_epilogue_begin opcode takes no operands. It sets the
> epilogue_begin register to “true”. When a breakpoint is set on the
> exit of a function or execution steps over the last executable
> statement of a function, it is generally desirable to suspend
> execution after completion of the last statement but prior to tearing
> down the frame (so that local variables can still be examined).
> Debuggers generally cannot properly determine where this point is.
> This command allows a compiler to communicate the location(s) to use.
> Note that the function to which the epilogue end applies cannot be
> directly determined from the line number information alone; it must be
> determined in combination with the subroutine information entries of
> the compilation (including inlined subroutines). In the case of a
> trivial function, both prologue end and epilogue begin may occur at
> the same address.
> -----

How should this work with shrink-wrapping?  The whole point of that is
you do not tear down the frame after all other code, etc.  I don't see
how we can do better than putting this DW_LNS_set_epilogue_begin right
before the actual return -- and that is after all the tear down etc.

> I had a look into
> gcc's involvement with "epilogue_begin". The pass called
> "pass_thread_prologue_and_epilogue" transitively calls a function
> defined in function.c called "make_epilogue_seq", which as far as I
> understand emits an "epilogue_begin" note. I'm not sure how this pass
> ties in with each frontend. Does a frontend need to support this pass
> explicitly?

Nope.  This pass is very late in the backend, after register allocation
and everything.  A frontend will just make functions "return", and that's
all it has to do.


Segher

  reply	other threads:[~2019-03-20 17:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 20:38 Justin Paston-Cooper
2019-03-19 21:29 ` Florian Weimer
2019-03-19 21:41   ` Justin Paston-Cooper
2019-03-19 21:52     ` Florian Weimer
2019-03-19 22:20       ` Justin Paston-Cooper
2019-03-19 22:40         ` Florian Weimer
2019-03-19 22:52           ` Justin Paston-Cooper
2019-03-20  8:31 ` Richard Biener
2019-03-20 10:13   ` Justin Paston-Cooper
2019-03-20 17:36     ` Segher Boessenkool [this message]
2019-03-20 19:05       ` Tom Tromey
2019-03-21  8:23         ` Richard Biener
2019-03-21  9:11           ` Justin Paston-Cooper
2019-03-21  9:34             ` Justin Paston-Cooper

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=20190320173633.GB3969@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc@gcc.gnu.org \
    --cc=paston.cooper@gmail.com \
    --cc=richard.guenther@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).