[gambit-list] Debugging problem

Christian Jaeger christian at pflanze.mine.nu
Sun Jan 18 08:11:49 EST 2009


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.html
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.




More information about the Gambit-list mailing list