[slime-devel] How to restart the inferior kawa swank server?
heller at common-lisp.net
Thu Aug 4 14:29:40 UTC 2011
* Leo [2011-08-04 11:44] writes:
> Assume you have inferior kawa scheme started as detailed in the
> beginning of file swank-kawa.scm. Now switch to the *inferior-lisp*
> buffer and do:
> M-: (slime-inferior-connect (get-buffer-process (current-buffer)) \
> (slime-inferior-lisp-args (get-buffer-process (current-buffer))))
I assume you do something like
shell# rlwrap java7 -Xss450k -cp /opt/java/current/lib/tools.jar:/scratch/kawa -agentlib:jdwp=transport=dt_socket,server=y,suspend=n kawa.repl -s
Listening for transport dt_socket at address: 39670
#|kawa:1|# (require "/home/helmut/lisp/slime/contrib/swank-kawa.scm")
#|kawa:2|# (create-swank-server 4005)
Then in Emacs M-x slime-connect followed by M-x slime-disconnect.
Then again in the terminal:
#|kawa:3|# (create-swank-server 4005)
> You should see the following error, which disallows one to restart the
> swank server. Any fix? Thanks in advance.
A little background info: the swank server uses the JVM debugging tools
in roundabout way. Swank connects to the debugging agent running in the
same JVM; essentially one JVM debugs itself. As instructed by the
command line option -agentlib, the JVM opens a socket (on port 39670 in
the example above). Later we attach to it. Once we are connected
nothing is listening on that port. On Linux you can verify that with
netstat -tlnp. Since nothing is listening we get the "Unable to
determine transport endpoint" exception.
A fix would probably not attach twice, but instead store the vm mirror
in a global variable and reuse it as needed.
This patch seems to work:
@@ -1267,7 +1267,7 @@
(df vm-monitor ((c <chan>))
(! set-name (current-thread) "swank-vm-monitor")
- (let ((vm (vm-attach)))
+ (let ((vm :: <vm> (or *the-vm* (vm-attach))))
(mlet* (((ev . _) (spawn/chan/catch
More information about the slime-devel