[Sbcl-help] SLIME, SBCL, saving and using images

101 views
Skip to first unread message

Tamas K Papp

unread,
Apr 5, 2011, 9:41:33 AM4/5/11
to sbcl...@lists.sourceforge.net
Hi,

I am debugging a library with an FFI which sometimes segfaults because
of memory problems (not a problem with SBCL, but bugs in the interface
I am writing). Then I have to restart the lisp process, load
everything, etc, which is a bit cumbersome.

I thought of saving a lisp image at a "safe" point (ie before testing
the buggy functions) and reloading it, but I could not figure out how
to do this in SLIME. The reloading looks easy with

(setq slime-lisp-implementations
'((my-image ("sbcl" "--core /home/tpapp/my.core"))))

in my .emacs, but when I want to use

CL-USER> (sb-ext:save-lisp-and-die #P"/home/tpapp/my.core")

SBCL complains about multiple threads -- I guess this is SLIME/swank,
I don't use threads in my code. I looked at the docs, which told me
that I can take care of this with SB-EXT:*SAVE-HOOKS*, but I don't
know how to go about this. I wonder if someone could give me
details/examples on how to establish a workflow of saving and using
images with SLIME & SBCL.

Thanks,

Tamas

PS.: If that matters, I am using SBCL 1.0.45 (but I can upgrade if
necessary) and SLIME 2011-03-13.


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Sbcl-help mailing list
Sbcl...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help

Jean-Philippe Paradis

unread,
Apr 5, 2011, 12:09:19 PM4/5/11
to sbcl...@lists.sourceforge.net
There was a great post about that by Zach on some mailing list or
other some time ago but I couldn't find it so I'll paraphrase.

The easiest way to dump an image is to do the dumping before threads
even enter the picture at all.

So you make a load.lisp file containing the code to load everything
you need in the image, and the last thing this file does is invoke
SAVE-LISP-AND-DIE.

Then it's a simple matter of "sbcl --script load.lisp" and you have your image!

Reply all
Reply to author
Forward
0 new messages