From: Lei
Subject: Any easier way to reload?
Date: 
Message-ID: <ejvdav$fg1$1@news.asu.edu>
Hi, I am writing some lisp code. When I execute it, it just returns me
"evaluation aborted;" So I have reload everything.

I am wondering whether there's any scheme to restore to the status just 
before my program crashes.

btw: I use lisp in a box + Clisp.

Any suggestion would be highly appreciated!

-Lei

From: Pascal Bourguignon
Subject: Re: Any easier way to reload?
Date: 
Message-ID: <87zmaky5gk.fsf@thalassa.informatimago.com>
Lei <······@asu.edu> writes:

> Hi, I am writing some lisp code. When I execute it, it just returns me
> "evaluation aborted;" So I have reload everything.

It's strange.  I've never seen clisp return this error message.  
I don't find this error message in the sources of clisp.

Could you show us what form you try to evaluate, and how you do it?


> I am wondering whether there's any scheme to restore to the status
> just before my program crashes.
> btw: I use lisp in a box + Clisp.
> Any suggestion would be highly appreciated!

If the program crashes, the OS usually garbage collect its memory
space, so there's no way to restore it.  In some cases, you can have
the OS dump a core.  Then you could, theorically, reload this core, to
debug the crash, and possibly recover and go on execution.  But I
don't know any tool able to do it on unix (AFAIK gdb doesn't allow
continuing the execution of a core, only to inspect it).


Before a lisp program crashes, you can save an image. With clisp,
using EXT:SAVEINITMEM.  Unfortunately, such an image saving doesn't
preserve open files and open sockets, etc.  (IIRC recent clisps try to
open anew open files, shared libraries, etc, when loading the image,
but it's not always possible, and for sockets it's very difficult to
replay the protocols to the state they were when the image is saved).
When you load a saved image, the execution doesn't resume to where it
was when the image was saved, but a new "main" function you can
specify is called.  So, you'd have to prepare a way to checkpoint your
processings and restart them, to be able to use this feature to save a
checkpoint before a potential crash.

Of course, if you consider only REPL interaction, you can without
problem save the image just after each form you evaluate at the REPL,
so if it crashes for the next, you can recover from the last form.


For example, you can take the REPL from:
http://groups.google.com/group/comp.lang.lisp/msg/69a9b711e578dcc1
and insert the form:

  (ext:saveinitmem 
     (make-pathname :defaults *check-point-directory*
                    :name (format nil "~A" (get-universal-time))
                    :type (format nil "~V,'0D" 
                            (log INTERNAL-TIME-UNITS-PER-SECOND 10)
                            (GET-INTERNAL-RUN-TIME))
                    :version nil)
     :norc t
     :init-function (function repl))

after (finish-output) in the function REPL.

This will create a lot of saved image, you'd have to delete the oldest
versions.  Perhaps you want to keep only two versions. Have fun with
RENAME-FILE and DELETE-FILE.

But this won't solve your problem, even if it answers your question,
since I think the crash and error message don't come from clisp.



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"A TRUE Klingon warrior does not comment his code!"
From: Lars Rune Nøstdal
Subject: Re: Any easier way to reload?
Date: 
Message-ID: <pan.2006.11.21.21.09.08.823260@gmail.com>
On Tue, 21 Nov 2006 20:17:47 +0100, Pascal Bourguignon wrote:

> Lei <······@asu.edu> writes:
> 
>> Hi, I am writing some lisp code. When I execute it, it just returns me
>> "evaluation aborted;" So I have reload everything.
> 
> It's strange.  I've never seen clisp return this error message.  
> I don't find this error message in the sources of clisp.

SBCL has a message like this:

  cl-user> (/ 10 0)
  (i select [abort-request] at condition that pops up)
  ; Evaluation aborted
  cl-user>

I think more information about what's going on is needed. Maybe Lei means
conditions and restarts:
  http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html

?

-- 
Lars Rune Nøstdal
http://lars.nostdal.org/
From: Juho Snellman
Subject: Re: Any easier way to reload?
Date: 
Message-ID: <slrnem7l2m.scp.jsnell@sbz-30.cs.Helsinki.FI>
Lars Rune N�stdal <···········@gmail.com> wrote:
> SBCL has a message like this:
>
>   cl-user> (/ 10 0)
>   (i select [abort-request] at condition that pops up)
>   ; Evaluation aborted
>   cl-user>

That's a message from Slime, not from SBCL.

-- 
Juho Snellman
From: Rob Thorpe
Subject: Re: Any easier way to reload?
Date: 
Message-ID: <1164200143.373013.180580@k70g2000cwa.googlegroups.com>
Juho Snellman wrote:
> Lars Rune Nøstdal <···········@gmail.com> wrote:
> > SBCL has a message like this:
> >
> >   cl-user> (/ 10 0)
> >   (i select [abort-request] at condition that pops up)
> >   ; Evaluation aborted
> >   cl-user>
>
> That's a message from Slime, not from SBCL.

Indeed, SBCL is equally terminological, but certainly says what's going
on:-
* (/ 10 0)

debugger invoked on a DIVISION-BY-ZERO:
  arithmetic error DIVISION-BY-ZERO signalled
Operation was SB-KERNEL::DIVISION, operands (10 0).

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-KERNEL::INTEGER-/-INTEGER 10 0)
0]
From: John Thingstad
Subject: Re: Any easier way to reload?
Date: 
Message-ID: <op.tjdtvki2pqzri1@pandora.upc.no>
On Tue, 21 Nov 2006 18:35:44 +0100, Lei <······@asu.edu> wrote:

> Hi, I am writing some lisp code. When I execute it, it just returns me
> "evaluation aborted;" So I have reload everything.
>
> I am wondering whether there's any scheme to restore to the status just  
> before my program crashes.
>
> btw: I use lisp in a box + Clisp.
>
> Any suggestion would be highly appreciated!
>
> -Lei

When a program crashes it can be very difficult to isolate where
the error occurs. What I usually do is comment out half the code
and then see if it still crashes. If it does I uncomment the code
and comment half of the previously uncommented code. I thus binary
search out the offending function. Never had to do this in Lisp
though. The one one thing I can think of that can make a Lisp
image abort cold is a DEP exception. This might explain why the
error message is not in the CLISP source. Simple enough to check..
Disable DEP for that app and see if it still occurs..
Just grasping at straws here so I give no guaranties.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: Alex Mizrahi
Subject: Re: Any easier way to reload?
Date: 
Message-ID: <456365fe$0$49195$14726298@news.sunsite.dk>
(message (Hello 'Lei)
(you :wrote  :on '(Tue, 21 Nov 2006 10:35:44 -0700))
(

 L> Hi, I am writing some lisp code. When I execute it, it just returns me
 L> "evaluation aborted;" So I have reload everything.

is clisp process still present after this message?
SLIME writes this message when it looses connection to lisp. this can be 
because of crash of lisp, or because of something weird sent over 
connection. you can check slime's log (there is such buffer in emacs). also 
you can get buffer with clisp console toplevel, maybe it has some message, 
or is interactive, if clisp is still alive.
and if clisp is active, you can bring it back with "slime" command.

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"People who lust for the Feel of keys on their fingertips (c) Inity") 
From: Timofei Shatrov
Subject: Re: Any easier way to reload?
Date: 
Message-ID: <45641470.3541662@news.readfreenews.net>
On Tue, 21 Nov 2006 10:35:44 -0700, Lei <······@asu.edu> tried to confuse
everyone with this message:

>Hi, I am writing some lisp code. When I execute it, it just returns me
>"evaluation aborted;" So I have reload everything.

You probably used (quit) in your code. This is not a good practice if you want
to run programs interactively. To be able to reload everything quickly, write a
file "load.lisp" which loads all your files in the desired order. Or use ASDF
(described in Practical Common Lisp).


-- 
|Don't believe this - you're not worthless              ,gr---------.ru
|It's us against millions and we can't take them all... |  ue     il   |
|But we can take them on!                               |     @ma      |
|                       (A Wilhelm Scream - The Rip)    |______________|