As Luke knows, I've been having some problems with the latest cmucl cvs and slime. Whenever emacs connects to the swank server, cmucl immediately gets a bus error. (It shouldn't do that, but I don't know why.)
I think I finally tracked this down. In cmucl cvs, Helmut's source-location patches have been incorporated. However, swank-cmucl.lisp references some unknown functions such as file-source-location-tlf-number. There's also a bug in resolve-file-source-location:
(defun resolve-file-source-location (location) (let ((filename (c::file-source-location-pathname location)) (tlf-number (c::file-source-location-tlf-number location)) (form-number (c::file-source-location-tlf-number location)))
Presumably the tlf-number and form-number should not be the same; form-number should be from file-source-location-form-number.
Anyway, attached is a simple hack patch that fixes these issues. At least slime is now working again with cmucl cvs. :-1
Thanks for the great tool!
Ray
Index: swank-cmucl.lisp =================================================================== RCS file: /project/slime/cvsroot/slime/swank-cmucl.lisp,v retrieving revision 1.94 diff -u -r1.94 swank-cmucl.lisp --- swank-cmucl.lisp 6 Apr 2004 10:42:53 -0000 1.94 +++ swank-cmucl.lisp 17 Apr 2004 01:41:54 -0000 @@ -712,10 +712,22 @@ `(:function-name ,string))) (t (list :error (princ-to-string c))))))
+(defun file-source-location-tlf-number (location) + (nth-value 0 (decode-form-numbers (c::file-source-location-form-numbers location)))) + +(defun file-source-location-form-number (location) + (nth-value 1 (decode-form-numbers (c::file-source-location-form-numbers location)))) + +(defun source-location-tlf-number (location) + (nth-value 0 (decode-form-numbers (c::file-source-location-form-numbers location)))) + +(defun source-location-form-number (location) + (nth-value 1 (decode-form-numbers (c::file-source-location-form-numbers location)))) + (defun resolve-file-source-location (location) (let ((filename (c::file-source-location-pathname location)) - (tlf-number (c::file-source-location-tlf-number location)) - (form-number (c::file-source-location-tlf-number location))) + (tlf-number (file-source-location-tlf-number location)) + (form-number (file-source-location-form-number location))) (with-open-file (s filename) (let ((pos (form-number-stream-position tlf-number form-number s))) (make-location `(:file ,(unix-truename filename)) @@ -723,8 +735,8 @@
(defun resolve-source-location (location) (let ((info (c::source-location-user-info location)) - (tlf-number (c::source-location-tlf-number location)) - (form-number (c::source-location-tlf-number location))) + (tlf-number (source-location-tlf-number location)) + (form-number (source-location-form-number location))) ;; XXX duplication in frame-source-location (assert (info-from-emacs-buffer-p info)) (destructuring-bind (&key emacs-buffer emacs-buffer-string
Raymond Toy rtoy@earthlink.net writes:
I think I finally tracked this down. In cmucl cvs, Helmut's source-location patches have been incorporated. However, swank-cmucl.lisp references some unknown functions such as file-source-location-tlf-number. There's also a bug in resolve-file-source-location:
My experimental version looked a bit differently from the version in cmucl cvs.
(defun resolve-file-source-location (location) (let ((filename (c::file-source-location-pathname location)) (tlf-number (c::file-source-location-tlf-number location)) (form-number (c::file-source-location-tlf-number location)))
Presumably the tlf-number and form-number should not be the same; form-number should be from file-source-location-form-number.
Hehe, I wonder how this ever worked.
Anyway, attached is a simple hack patch that fixes these issues. At least slime is now working again with cmucl cvs. :-1
Thanks for the great tool!
Ray
Index: swank-cmucl.lisp
Thanks for the patch. I applied it.
BTW, what do you think about recording the source location for defvar, defparamater and defconst? A simple way to do it, would be to store the source location in the property list, like so:
(defmacro defvar (var &optional (val nil valp) (doc nil docp)) `(progn (setf (get (quote ,var) 'source-location) (c::source-location)) (declaim (special ,var)) ,@(when valp `((unless (boundp ',var) (setq ,var ,val)))) ,@(when docp `((setf (documentation ',var 'variable) ',doc))) ',var))
Perhaps there is a more GC friendly place than the property list. I haven't tried, but I hope that recording the source location for variables doesn't need too much space.
Helmut.
"Helmut" == Helmut Eller e9626484@stud3.tuwien.ac.at writes:
Helmut> Thanks for the patch. I applied it.
Perhaps a nicer solution would be something like
(defun resolve-file-source-location (location) (let ((filename (c::file-source-location-pathname location)) (multiple-value-bind (tlf-number form-number) (decode-form-numbers (c::file-source-location-form-numbers location)) ...))))
Then you can get rid of the *-tlf-number and *-form-number functions.
Helmut> BTW, what do you think about recording the source location Helmut> for defvar, defparamater and defconst? A simple way to do Helmut> it, would be to store the source location in the property Helmut> list, like so:
I must confess I haven't used the source-location stuff in slime at all, except in the debugger. But I've often wanted to know where defvar's and such were defined and end up using grep to find it.
Helmut> Perhaps there is a more GC friendly place than the Helmut> property list. I haven't tried, but I hope that recording Helmut> the source location for variables doesn't need too much Helmut> space.
Your solution seems reasonable.
Ray