[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How can I enable tracing in a script?
From: |
Eric Hanchrow |
Subject: |
How can I enable tracing in a script? |
Date: |
Tue, 25 May 2004 10:35:44 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux) |
(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
which is what I see when I use the REPL to define `something', and
invoke it. But I don't. Am I misunderstanding something? (Note that
I don't really believe all the cruft in this script is necessary; I
was merely throwing in everything I could think of to get tracing to
work)
#!/usr/local/bin/guile \
--debug -e main
!#
(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))))
;(something 9)
--
But users will not now with glad cries glom on to a language that
gives them no more than what Scheme or Pascal gave them.
-- Guy Steele,
http://www.sun.com/research/jtech/pubs/98-oopsla-growing.ps
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- How can I enable tracing in a script?,
Eric Hanchrow <=