So I'm looking more in lib/_repl.scm, in particular at:<br><br>(define-prim (##interp-procedure-default-entry-hook proc) <br> (let ((hook (##interp-procedure-entry-hook proc))) <br>
(if (and hook <br> (##closure? hook) <br> (##eq? (##subprocedure-parent (##closure-code hook)) <br>
##make-default-entry-hook)) <br> hook <br> #f)))<br><br><br>and I'm wondering two things:<br>
<br>1) in trace, where is the pp / display / write<br><br>2) after the proc is setup by ##interp-procedure-default-entry-hook, where in the interpreter is proc called?<br><br><div class="gmail_quote">On Fri, Feb 20, 2009 at 8:31 PM, lowly coder <span dir="ltr"><<a href="mailto:lowlycoder@huoyanjinjing.com">lowlycoder@huoyanjinjing.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">hmm, this is in lib/_repl.scm<br><br>and I see:<br><br><br>(define-prim (##trace proc) <br>
<br>
(define (setup hook) <br> (let ((settings (##closure-ref hook 1))) <br> (##vector-set! settings 1 #t) <br>
(if (##not (##memq proc ##trace-list)) <br> (set! ##trace-list (##cons proc ##trace-list))))) <br> <br>
(let ((hook (##interp-procedure-default-entry-hook proc))) <br> (if hook <br> (setup hook) <br>
(let ((new-hook (##make-default-entry-hook))) <br> (##interp-procedure-entry-hook-set! proc new-hook) <br> (setup new-hook))))) <br><br>
<br>is "##interp-procedure-entry-hook-set!" a function that gets called whenever a function gets hit with 'eval' ?<div><div></div><div class="Wj3C7c"><br><br><br><div class="gmail_quote">On Fri, Feb 20, 2009 at 8:21 PM, lowly coder <span dir="ltr"><<a href="mailto:lowlycoder@huoyanjinjing.com" target="_blank">lowlycoder@huoyanjinjing.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Okay, so I almost think I have a solution to this.<br><br>Can I have something like "trace", where instead of printing the argument line, it passes it to a function?<br>
<br>Like a function uber-trace<br><br>where:<br>
<br>(trace foo) = (uber-trace foo (lambda (args) (pp args)))<div><div></div><div><br><br><br><br><div class="gmail_quote">On Fri, Feb 20, 2009 at 8:04 PM, lowly coder <span dir="ltr"><<a href="mailto:lowlycoder@huoyanjinjing.com" target="_blank">lowlycoder@huoyanjinjing.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Code:<br><br>~/code/irc$ cat trace.scm<br>(define (foo x) x)<br><br>(define (bar) (foo 0))<br>
<br>(define (test)<br> (foo 1)<br> (bar))<br> <br>(trace foo)<br><br>(test)<br>~/code/irc$ gsi trace.scm<br>| > (foo 1)<br>
| 1<br>| > (foo 0)<br>| 0<br><br><br>Problem:<br><br>Can I control trace where I can say "trace foo, but not when it's called by bar".<br><br>I.e. rather than just saying "trace this function", I would like to be able to say:<br>
<br><br>(trace foo predicate)<br><br>where predicate is a function that takes as input the "stack" frame, and as output creates a #t / #f, which decides whether this particular trace should be printed<br><br><br>
<br>On a side note -- all the cool debugging functions in Gambit -- is this part of the 100K LOC scheme or 50K LOC hand written C? (hoping it's the former)<br>
</blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>