This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Indicating function exit points in debug data
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