Hi,

You have to crack the locat structure, here's a helper function that I use:

(define (continuation-location cont)
    (let (
            (locat (##continuation-locat cont))
        )
        (if locat
            (let* (                   
                    (container (##locat-container locat))
                    (path (##container->path container))
                    (position (##locat-position locat))
                    (filepos (##position->filepos position))
                    (line (fx+ (##filepos-line filepos) 1))
                    (col (fx+ (##filepos-col filepos) 1))
                )
                (values path line col)
            )
            (values #f #f #f)
        )
    )
)


The guts of this Marc posted a while back for FILE and LINE macros.... v. useful!

Cheers
Darren


lowly coder wrote:
~/test$ gsi test.scm -e "(a)"
*** ERROR IN a, "test.scm"@1.23 -- Unbound variable: b
~/test$ gsi test.scm -e "(run)"
#f
#("/home/x/test/test.scm" 1441792)
#("/home/x/test/test.scm" 1048576)
#("/home/x/test/test.scm" 786432)
#f
#((string) 0)
#f
#f
25
~/test$ cat test.scm
(define (a) (pp (+ 20 b)))


(define (run)
  (let ((old-handler (current-exception-handler)))
    (with-exception-handler
      (lambda (e)
    (with-exception-handler
      old-handler
      (lambda ()

        (##continuation-capture
         (lambda (old-cont)
           (do
         ;((cur-frame cont (##continuation-next-frame cur-frame #t)))
         ((cont old-cont (##continuation-next-frame cont #t)))
         ((not cont))
         (pp (##continuation-locat cont)))

           (##continuation-return old-cont 5)))

        )))
      (lambda ()
    (a)))))


Why is it ... that when I print out the continuations by frame, I can't get the data that I want (which ##cmd-b apparently does get, which is: test.scm, line 1, character 23).

This baffles me.

(I'm trying to write a gambit debugger in gambit, teehee)

Thanks!

_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list