So I've recently been bringing some old code up to speed on current Gambit (4.4.0) and I seem to be running afoul of some combination of the REPL changes and the debugger that have me totally blocked.
When I run the compiled version of the program, I get the *no* output from the program and the following:
*** ERROR IN call-with-values -- (Argument 2) LIST expected (apply '#<procedure #2> '#<unknown>)
and the program very nicely exits back to the shell. However when I run the same code (e.g. I invoke the main function with the args that would come in from the command-line) in an interactive REPL under XEmacs, I get the expected program output, but no error message and a hung gsc that doesn't respond to ^C so I end up kill -KILL ing it. Running in a proper tty (a ssh session into the host) I get the same out put as under XEmacs, followed by a "0" and then Gambit's command prompt.
What's going on here? And how can I get to the debugger to try and find the culprit call-with-values? I should mention that this code does currently run under Larceny 0.96 (a bit behind the bleeding edge of Larceny dev) and has previously run under at least half a dozen different R4RS schemes.
Thanks in advance
david rush
Afficher les réponses par date
David Rush wrote:
So I've recently been bringing some old code up to speed on current Gambit (4.4.0) and I seem to be running afoul of some combination of the REPL changes and the debugger that have me totally blocked.
When I run the compiled version of the program, I get the *no* output from the program and the following:
*** ERROR IN call-with-values -- (Argument 2) LIST expected (apply '#<procedure #2> '#<unknown>)
and the program very nicely exits back to the shell. However when I run the same code (e.g. I invoke the main function with the args that would come in from the command-line) in an interactive REPL under XEmacs, I get the expected program output, but no error message and a hung gsc that doesn't respond to ^C so I end up kill -KILL ing it. Running in a proper tty (a ssh session into the host) I get the same out put as under XEmacs, followed by a "0" and then Gambit's command prompt.
Without seeing the code or a stripped-down version of it it's difficult to tell.
What's going on here? And how can I get to the debugger to try and find the culprit call-with-values?
- put (step) at some good place before the problematic part into your code - if your program can afford it memory-wise, try (generate-proper-tail-calls #f) - reload the code into the interpreter, start it. Once it stopped, use ,s / ,l / ,c or their gambit emacs mode wrappers (gambit-step-continuation, gambit-leap-continuation, gambit-continue, create keybindings for those) or of course the other debugger commands, read the "Debugging" section of the manual.
If you've got difficulties finding the right spot in your program, you can also capture continuations while the program is running and use them to go back once you got the exception; this works well as long as your program doesn't use mutation. See https://webmail.iro.umontreal.ca/pipermail/gambit-list/2007-April/001329.htm... for an example of this. If you use continuation-capture instead of call/cc you can use (##repl-within the-continuation "") or nowadays ,(v the-continuation) to inspect it.
Christian.
2009/1/18 Christian Jaeger christian@pflanze.mine.nu:
David Rush wrote:
So I've recently been bringing some old code up to speed on current Gambit (4.4.0) and I seem to be running afoul of some combination of the REPL changes and the debugger that have me totally blocked.
When I run the compiled version of the program, I get the *no* output from the program and the following:
*** ERROR IN call-with-values -- (Argument 2) LIST expected (apply '#<procedure #2> '#<unknown>)
...
Without seeing the code or a stripped-down version of it it's difficult to tell.
Well it's 22KLOC and moderately inbred with heavy use of an unholy hybrid of call/cc and call-with-values to implement a wacky tail-recursive pattern matcher. Oh yeah, and lots of anonymous functions. This is really more a question about how the debug REPL works (or fails to).
What's going on here? And how can I get to the debugger to try and find the culprit call-with-values?
- put (step) at some good place before the problematic part into your code
I have no idea where that is. This is why I'm trying to get a backtrace from the actual error location.
- if your program can afford it memory-wise, try
(generate-proper-tail-calls #f)
That is an option I'd forgotten. Will it help (as in get me a stack dump) with the compiled code? After further testing, the problem appears to simply not arise under the interpreter.
If you've got difficulties finding the right spot in your program, you can also capture continuations while the program is running and use them to go back once you got the exception;
This (now) is essentially the problem. I don't get an exception running under the REPL. I'd like to get a stack dump while running compiled, actually
david rush