Re: [Sbcl-help] [fricas-devel] Re: interrupt in sbcl

On 20 Jan 2008 10:21:49 +0100, Martin Rubey <martin.rubey@...> wrote:
> )se br query
> for i in 1..100000 repeat i^2; "hi"
>
> doesn't allow you to abort the computation other than quitting axiom. Without
> the *debugger-hook* below one can do this by typing TOP, although this throws
> another error:
>
> attempt to THROW to a tag that does not exist: SB-INT:TOPLEVEL-CATCHER
>
This is interesting. When in the debugger for this error, please type
ba
an the terminal to obtain a backtrace. I should like to see it -- something
moderately odd is going on it TOPLEVEL-CATCHER catch tag isn't there.
Cheers,
-- Nikodemus

The following seems to exhibit similar behaviour as the gcl variant.
Curiously, both do not continue computation in interpreter when told to do. For
example, hitting Ctrl-C during the loop in
)se br resume
for i in 1..100000 repeat i^2; "hi"
doesn't print the "hi". Well, I don't care too much. In input files, it still
seems to work.
More serious is the following
)se br query
for i in 1..100000 repeat i^2; "hi"
doesn't allow you to abort the computation other than quitting axiom. Without
the *debugger-hook* below one can do this by typing TOP, although this throws
another error:
attempt to THROW to a tag that does not exist: SB-INT:TOPLEVEL-CATCHER
I have no idea how to fix that properly, but I guess it has to do with entering
the error handler again... Although, really, there should be a restart that
aborts the computation, but (compute-restarts) doesn't find it...
Should I commit this? How could I test it more thoroughly?
Martin
#-(or :GCL :CCL)
(eval-when (load eval)
(setq *debugger-hook*
(lambda (condition me-or-my-encapsulation)
(block nil
(setq |$NeedToSignalSessionManager| T)
(if (and (boundp '|$inLispVM|) (boundp '|$BreakMode|))
(cond ((eq |$BreakMode| '|validate|)
(|systemError| (error-format condition)))
((and (eq |$BreakMode| '|trapNumerics|)
(typep condition 'error))
(setq |$BreakMode| nil)
(throw '|trapNumerics| |$numericFailure|))
((and (eq |$BreakMode| '|trapNumerics|)
(boundp '|$oldBreakMode|)
(setq |$BreakMode| |$oldBreakMode|)
nil)) ;; resets error handler
((and (null |$inLispVM|)
(memq |$BreakMode| '(|nobreak| |query| |resume|)))
(let ((|$inLispVM| T)) ;; turn off handler
(return
(|systemError| (error-format condition)))))
((eq |$BreakMode| '|letPrint2|)
(setq |$BreakMode| nil)
(throw '|letPrint2| nil))))))))

On 20 Jan 2008 10:21:49 +0100, Martin Rubey <martin.rubey@...> wrote:
> )se br query
> for i in 1..100000 repeat i^2; "hi"
>
> doesn't allow you to abort the computation other than quitting axiom. Without
> the *debugger-hook* below one can do this by typing TOP, although this throws
> another error:
>
> attempt to THROW to a tag that does not exist: SB-INT:TOPLEVEL-CATCHER
>
This is interesting. When in the debugger for this error, please type
ba
an the terminal to obtain a backtrace. I should like to see it -- something
moderately odd is going on it TOPLEVEL-CATCHER catch tag isn't there.
Cheers,
-- Nikodemus

On 20 Jan 2008 14:30:37 +0100, Martin Rubey <martin.rubey@...> wrote:
> Here you go. I hope it's useful, even if it looks cryptic to me...
Thanks. The trouble is that SBCL debugger expects SB-INT:TOPLEVEL-CATCHER to
be there, but since Axiom provides its own toplevel function (via
SAVE-LISP-AND-DIE),
it is not.
Either SBCL has to document the requirement to bind SB-INT:TOPLEVEL-CATCHER, or
it needs to provide around the call to user-defined toplevel function.
(Or detect
the lack of the same and act different, or...)
Cheers,
-- Nikodemus