From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4781 invoked from network); 25 Aug 2008 17:23:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 25 Aug 2008 17:23:01 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 48484 invoked from network); 25 Aug 2008 17:22:52 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Aug 2008 17:22:52 -0000 Received: (qmail 15364 invoked by alias); 25 Aug 2008 17:22:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25532 Received: (qmail 15345 invoked from network); 25 Aug 2008 17:22:40 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 25 Aug 2008 17:22:40 -0000 Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com [81.103.221.48]) by bifrost.dotsrc.org (Postfix) with ESMTP id BFE818030846 for ; Mon, 25 Aug 2008 19:22:36 +0200 (CEST) Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20080825172236.OJBG21103.mtaout02-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Mon, 25 Aug 2008 18:22:36 +0100 Received: from pws-pc ([81.107.43.40]) by aamtaout04-winn.ispmail.ntl.com with ESMTP id <20080825172236.YHV18637.aamtaout04-winn.ispmail.ntl.com@pws-pc> for ; Mon, 25 Aug 2008 18:22:36 +0100 Date: Mon, 25 Aug 2008 18:22:29 +0100 From: Peter Stephenson To: "Zsh hackers list" Subject: Re: skipping assignment and function statements; Interactive comments Message-ID: <20080825182229.50299852@pws-pc> In-Reply-To: <6cd6de210808222115x56de11bdv957bb8cc21358789@mail.gmail.com> References: <6cd6de210808222115x56de11bdv957bb8cc21358789@mail.gmail.com> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.92.1/8086/Mon Aug 25 14:20:55 2008 on bifrost X-Virus-Status: Clean On Sat, 23 Aug 2008 00:15:31 -0400 "Rocky Bernstein" wrote: > I just added a skip command to zshdb (and committed to github), but it > seems that assignment statements and function definitions are not > really skipped. Yes, thanks, there's yet another infuriating special case of the sort that makes me wish I'd picked an easier project. That's the third change here; the stuff with intrap is because it doesn't detect that it's already inside a trap (and hence should skip debugging) until it gets into dotrapargs(), and in this case it seems neater not to go to the trouble. This will be even more sensible when I get around to regenerating the line to be debugged at this point. Index: Src/exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.141 diff -u -r1.141 exec.c --- Src/exec.c 22 Aug 2008 15:41:31 -0000 1.141 +++ Src/exec.c 25 Aug 2008 17:21:19 -0000 @@ -1068,7 +1068,7 @@ lineno = lnp1 - 1; } - if (sigtrapped[SIGDEBUG] && isset(DEBUGBEFORECMD)) { + if (sigtrapped[SIGDEBUG] && isset(DEBUGBEFORECMD) && !intrap) { int oerrexit_opt = opts[ERREXIT]; opts[ERREXIT] = 0; noerrexit = 1; @@ -1086,11 +1086,12 @@ donedebug = isset(ERREXIT) ? 2 : 1; opts[ERREXIT] = oerrexit_opt; } else - donedebug = 0; + donedebug = intrap ? 1 : 0; if (ltype & Z_SIMPLE) { next = state->pc + WC_LIST_SKIP(code); - execsimple(state); + if (donedebug != 2) + execsimple(state); state->pc = next; goto sublist_done; } Index: Test/C03traps.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/C03traps.ztst,v retrieving revision 1.14 diff -u -r1.14 C03traps.ztst --- Test/C03traps.ztst 7 Aug 2008 16:25:16 -0000 1.14 +++ Test/C03traps.ztst 25 Aug 2008 17:21:19 -0000 @@ -415,6 +415,20 @@ >3 three >5 five + # Assignments are a special case, since they use a simpler + # wordcode type, so we need to test skipping them separately. + fn() { + setopt localtraps localoptions debugbeforecmd + trap '(( LINENO == 4 )) && setopt errexit' DEBUG + x=three + x=four + print $LINENO $x + [[ -o errexit ]] && print "Hey, ERREXIT is set!" + } + fn +1:Skip assignment from DEBUG trap +>5 three + %clean rm -f TRAPEXIT -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/