unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Eric Hanchrow <offby1@blarg.net>
Subject: How can I enable tracing in a script?
Date: Tue, 25 May 2004 10:35:44 -0700	[thread overview]
Message-ID: <87d64sif4f.fsf@offby1.atm01.sea.blarg.net> (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


             reply	other threads:[~2004-05-25 17:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-25 17:35 Eric Hanchrow [this message]
2004-06-09 20:23 ` How can I enable tracing in a script? Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d64sif4f.fsf@offby1.atm01.sea.blarg.net \
    --to=offby1@blarg.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).