http://github.com/GreyLensman/rl3/tree/webserver/rl3/env/debug.sls
(R6RS kinda sorta) Larceny.
I had it bound to my emacs. When debug was "disabled" the handler prints
the error and leaves you at the top level REPL and not in the debugger. Its
just a simple example. Dave's solution actually give a solution for your
specific concern.
There is some other Larceny ERR5RS sorta/kinda R6RS code there as well.
compile-stale-libraries requires a Linux box. Its mostely web oriented.
SXML, Amazon Cloud client code, a small REST web server, etc...
Unfortunately its not well documented and a bit of mess. I hope to get back
to it early next year.
Post by David RushPost by Marco MaggiPost by William D ClingerPost by Marco MaggiAfter hitting C-c, I see that the debugger is here
and I can exit it with "q". And I am left with a prompt?
Yes. It isn't a very useful prompt, since nothing is
in scope, but it's a prompt.
Nothing is in scope until I issue "(import (rnrs))",
then I do what I want with escalated privileges.
As I said earlier, if you're running setuid, you should have
*thoroughly* debugged your code. Then you will not hit the prompt.
Post by Marco MaggiIt would suffice to have a command line switch that
makes the process exit whenever an exception is not
blocked.
How about installing your own error-handler that just exits the
program? There's a really simple API for this. You could minimally
(error-handler (lambda _ (exit)))
and get your result. Which is not very helpful because is you haven't
debugged sufficiently that you are still getting errors which
terminate the program, you generally would like to know what went
wrong. Hence the following code (which is part of my Larceny standard
(require 'inspect-cont)
(define (batch/last-chance-handler puts)
(lambda e
(define (display-line s)
(puts (with-output-to-string
(lambda() (write s)))))
(display-line `(lastchance error handler ,e))
(let* ((error-text
(call-with-output-string (lambda (p) (decode-error e p))))
(stacktrace (current-continuation-structure))
(inspector (make-continuation-inspector stacktrace))
(summarize-frame
(lambda (count inspector . prefix)
(let* ((frame (inspector 'get))
(code (frame 'code))
(class (code 'class))
(expr (code 'expression))
(proc (code 'procedure)))
(display-line
((system-procedure) '())
((interpreted-primitive) (procedure-name proc))
((interpreted-expression) expr)
((compiled-procedure) (procedure-name proc))
(else '())))
))))
(backtrace
(lambda (count inspector)
(let loop ((c (inspector 'clone)))
(let ((f (c 'get)))
(if (f 'same? (inspector 'get))
(summarize-frame 0 c "=> ")
(summarize-frame 0 c " ")))
(if (c 'down)
(loop c))
)))
)
(display-line `(decoded error ,error-text))
(backtrace 0 inspector)
(exit 0)
)))
(define (install-lastchance puts)
(error-handler (batch/last-chance-handler puts))
(install-lastchance puts-function)
where puts-function takes a string and does something appropriate with it.
david
--
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt
_______________________________________________
Larceny-users mailing list
https://lists.ccs.neu.edu/bin/listinfo/larceny-users