From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: How can I enable tracing in a script? Date: Wed, 09 Jun 2004 21:23:53 +0100 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <40C771D9.6090804@ossau.uklinux.net> References: <87d64sif4f.fsf@offby1.atm01.sea.blarg.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070207050607010106090003" X-Trace: sea.gmane.org 1086812662 11461 80.91.224.253 (9 Jun 2004 20:24:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 9 Jun 2004 20:24:22 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jun 09 22:24:14 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BY9cL-0003ZG-00 for ; Wed, 09 Jun 2004 22:24:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BY9cz-0001g8-Qh for guile-devel@m.gmane.org; Wed, 09 Jun 2004 16:24:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BY9cv-0001fU-AO for guile-devel@gnu.org; Wed, 09 Jun 2004 16:24:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BY9ct-0001eb-F1 for guile-devel@gnu.org; Wed, 09 Jun 2004 16:24:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BY9ct-0001eR-Cq for guile-devel@gnu.org; Wed, 09 Jun 2004 16:24:47 -0400 Original-Received: from [80.84.72.32] (helo=mail2.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BY9c8-0001a1-5F for guile-devel@gnu.org; Wed, 09 Jun 2004 16:24:00 -0400 Original-Received: from laruns.ossau.uklinux.net (unknown [213.78.65.234]) by mail2.uklinux.net (Postfix) with ESMTP id 3230A40A03D; Wed, 9 Jun 2004 20:23:58 +0000 (UTC) Original-Received: from ossau.uklinux.net (laruns [127.0.0.1]) by laruns.ossau.uklinux.net (Postfix) with ESMTP id C9EEB7750C; Wed, 9 Jun 2004 21:23:53 +0100 (BST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5 X-Accept-Language: en Original-To: Eric Hanchrow In-Reply-To: <87d64sif4f.fsf@offby1.atm01.sea.blarg.net> X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3783 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3783 This is a multi-part message in MIME format. --------------070207050607010106090003 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Eric Hanchrow wrote: >(recent CVS guile) > >When I run the following script, I want to see something like > > [something 3] > | [something 2] > | | [something 1] > | | | [something 0] > | | | 0 > | | 1 > | 3 > 6 > > > You're missing `with-traps'; see the attached script and output, which I produced with 1.6.4. Neil --------------070207050607010106090003 Content-Type: text/x-scheme; name="tr.scm" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tr.scm" #!/usr/bin/guile \ --debug -e main -s !# (use-modules (ice-9 debug)) (debug-enable 'trace) (trace-stack #t) ;;(debug-enable 'backtrace) ;;(format #t "~s~%" (debug-options)) ;;(format #t "~s~%" (traps)) ;;(format #t "~s~%" (evaluator-traps-interface)) ;;(format #t "~s~%" (list (@@(ice-9 debug) ;; trace-exit) ;; (@@(ice-9 debug) trace-entry))) ;;(evaluator-traps-interface `( exit-frame-handler ,(@@(ice-9 debug) trace-exit ))) ;;(evaluator-traps-interface `(apply-frame-handler ,(@@(ice-9 debug) trace-entry))) ;;(format #t "~s~%" (evaluator-traps-interface)) ;; ;;(format (current-error-port) "This message appears on the current error port.~%") ;;(format #t "traced-stack-ids: ~s~%" (@@(ice-9 debug) traced-stack-ids)) ;;(format #t "trace-all-stacks? ~s~%" (@@(ice-9 debug) trace-all-stacks?)) (define (something arg) (if (not (positive? arg)) 0 (+ arg (something (- arg 1))))) (define (main . args) ;; (trace something) (something (string->number (list-ref (car args) 1)))) (trace something) (with-traps (lambda () (something 9))) --------------070207050607010106090003 Content-Type: text/plain; name="output.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="output.txt" [something 9] | [something 8] | | [something 7] | | | [something 6] | | | | [something 5] | | | | | [something 4] | | | | | | [something 3] | | | | | | | [something 2] | | | | | | | | [something 1] | | | | | | | | | [something 0] | | | | | | | | | 0 | | | | | | | | 1 | | | | | | | 3 | | | | | | 6 | | | | | 10 | | | | 15 | | | 21 | | 28 | 36 45 Backtrace: In unknown file: ?: 0* (begin (load "./tr.scm") (main (command-line)) (quit)) ?: 1* [main ("./tr.scm")] In ./tr.scm: 30: 2 [something ... 30: 3* [string->number ... 30: 4* [list-ref ("./tr.scm") 1] ./tr.scm:30:30: In procedure list-ref in expression (list-ref (car args) 1): ./tr.scm:30:30: Argument 2 out of range: 1 --------------070207050607010106090003 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel --------------070207050607010106090003--