Hello Gambit-list and Marc!
I would have a simple request to enhance debugging in gambit. I often find myself to print backtraces, environments, etc to end up wondering "What was the error message again?". Then I always need to scroll back up to get it.
Would it be possible to add a new , command like ,error or something like that so that it can redisplay the last error message again? Is this error in a dynamic variable so that I can print it myself?
Thanks!
David
Afficher les réponses par date
On Sat, Jul 18, 2009 at 10:40:51AM -0400, David St-Hilaire wrote:
Would it be possible to add a new , command like ,error or something like that so that it can redisplay the last error message again? Is this error in a dynamic variable so that I can print it myself?
It is definitely possible. I wrote a small patch to do that and I'll look for it this morning. As I recall the patch calls a function that already exists in the REPL code, rather than printing a variable, but the effect is just as good.
What version of Gambit are you using?
-- Derek
Derek Peschel wrote:
It is definitely possible. I wrote a small patch to do that and I'll look for it this morning. As I recall the patch calls a function that already exists in the REPL code, rather than printing a variable, but the effect is just as good.
Ok great!
What version of Gambit are you using?
$ gsi -v v4.4.4 20090611032636 i686-pc-linux-gnu "./configure --prefix=/opt/gambit-c --enable-single-host"
Thank you :)
David
On Sat, Jul 18, 2009 at 02:11:16PM -0400, David St-Hilaire wrote:
$ gsi -v v4.4.4 20090611032636 i686-pc-linux-gnu "./configure --prefix=/opt/gambit-c --enable-single-host"
Thank you :)
You're welcome! I found my changes and regenerated the patch and included it below. It applies to v4.2.2 and I haven't tried changing any 4.3/4.4 versions or even downloaded them. I wanted to get _something_ posted right away, though, instead of making you wait.
The new command is ,r which is short for "reason". ,e is already short for "environment" so it can't be short for "error message" at the same time. The patch also fixes some indentation.
--- _repl.scm.orig Sun Feb 10 22:59:56 2008 +++ _repl.scm Sun Mar 2 02:50:04 2008 @@ -880,6 +880,7 @@ ,qt : Terminate the current thread ,t : Jump to toplevel REPL ,d : Jump to enclosing REPL +,r : Display reason for entering this REPL ,c and ,(c X) : Continue the computation with stepping off ,s and ,(s X) : Continue the computation with stepping on (step) ,l and ,(l X) : Continue the computation with stepping on (leap) @@ -2351,10 +2352,10 @@ (continue)) ((##eq? cmd 'e) (##repl-channel-display-multiline-message - (lambda (output-port) - (##cmd-e (first-interesting - (macro-repl-context-cont repl-context)) - output-port))) + (lambda (output-port) + (##cmd-e (first-interesting + (macro-repl-context-cont repl-context)) + output-port))) (continue)) ((##eq? cmd 't) (cmd-t)) @@ -2365,6 +2366,14 @@ (quit)) ((##eq? cmd 'qt) (quit-thread)) + ((##eq? cmd 'r) + (if write-reason + (##repl-channel-display-multiline-message + (lambda (output-port) + (write-reason (first-interesting + (macro-repl-context-cont repl-context)) + output-port)))) + (continue)) ((and (##fixnum? cmd) (##not (##fixnum.< cmd 0))) (goto-depth cmd))