unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* How can I enable tracing in a script?
@ 2004-05-25 17:35 Eric Hanchrow
  2004-06-09 20:23 ` Neil Jerram
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Hanchrow @ 2004-05-25 17:35 UTC (permalink / raw)



(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



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-09 20:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-25 17:35 How can I enable tracing in a script? Eric Hanchrow
2004-06-09 20:23 ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).