Zsh Mailing List Archive
Messages sorted by:
Re: Weird exit caused in a trap DEBUG which sources a file.
- X-seq: zsh-workers 25369
- From: Peter Stephenson <pws@xxxxxxx>
- To: "Rocky Bernstein" <rocky.bernstein@xxxxxxxxx>
- Subject: Re: Weird exit caused in a trap DEBUG which sources a file.
- Date: Fri, 01 Aug 2008 16:31:18 +0100
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <6cd6de210808010821g3117fe62y82bd580811dbba8a@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <6cd6de210807301938m28e05c84vf6296aa5b1bc0d44@xxxxxxxxxxxxxx> <200807310901.m6V91g8T002478@xxxxxxxxxxxxxx> <6cd6de210807310305q5954b65ax405f51e54d6754ee@xxxxxxxxxxxxxx> <6cd6de210808010529h11898619kba301fddf8b72f00@xxxxxxxxxxxxxx> <20080801143747.19b65086@news01> <6cd6de210808010821g3117fe62y82bd580811dbba8a@xxxxxxxxxxxxxx>
"Rocky Bernstein" wrote:
> On Fri, Aug 1, 2008 at 9:37 AM, Peter Stephenson <pws@xxxxxxx> wrote:
> > Thanks, this is what I needed.
> No, thank you! I just tried the patch and it works fine.
> So there's no mystery. I've been porting the bash debugger code to
> zsh. So far, print/eval, stepping and some stack frame commands work.
> But this is far from ready for general consumption.
This will be very useful.
> > The signals.c hunk is to save and restore trapreturn for nested trap
> > handlers. I'm not sure it's necessary; I am sure it's not wrong and
> > prevents hostages to fortune.
> Not sure the additional code is necessary or that nested trap handlers
> are necessary? I'm pretty sure you mean the former. Nested trap
> handlers are useful.
Yes, I'm talking about the additional code. I think it probably *is*
necessary for consistency, but there are cases where we disable nested
handling (so for example we don't run a DEBUG trap on commands when
we're inside a DEBUG trap).
> It seems weird that trapreturn is is initialised to -1 for a
> function trap and
> -2 for a non-function trap and decremented for subsequent function
> calls. Because this means that trapreturn for a for a function trap
> that calls a function would have the same value as for a non-function
This is because of the way an explicit "return" from a trap works (which
is documented in the manual). "return" with non-zero status from a
shell function forces the parent function to return; "return" with any
status from a non-function trap forces the immediately surrounding
function to return. In other words, the difference is there's an extra
level of functions in one case which we have to jump over for the
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by: