Permalink
Browse files

* swank-backend.lisp (frame-restartable-p): New function.

(swank-frame): Deleted. Update implemenetations accordingly.
(print-frame): Renamed back from print-swank-frame.

* swank.lisp (backtrace): Don't clutter the backtrace with
'(:restartable :unknown).  For practical purposes :unknown is the
same as nil.

* slime.el (sldb-compute-frame-face): Only accept nil or t for
the :restartable prop.
  • Loading branch information...
1 parent 601b824 commit 954bd865b5cde5b04a33a4d569a35b40f0c62405 Helmut Eller committed Oct 17, 2008
Showing with 90 additions and 88 deletions.
  1. +13 −0 ChangeLog
  2. +5 −9 slime.el
  3. +3 −3 swank-abcl.lisp
  4. +6 −3 swank-allegro.lisp
  5. +7 −9 swank-backend.lisp
  6. +3 −4 swank-clisp.lisp
  7. +3 −4 swank-cmucl.lisp
  8. +9 −7 swank-corman.lisp
  9. +3 −4 swank-ecl.lisp
  10. +7 −9 swank-lispworks.lisp
  11. +8 −10 swank-openmcl.lisp
  12. +5 −7 swank-sbcl.lisp
  13. +3 −4 swank-scl.lisp
  14. +15 −15 swank.lisp
View
@@ -1,3 +1,16 @@
+2008-10-17 Helmut Eller <heller@common-lisp.net>
+
+ * swank-backend.lisp (frame-restartable-p): New function.
+ (swank-frame): Deleted. Update implemenetations accordingly.
+ (print-frame): Renamed back from print-swank-frame.
+
+ * swank.lisp (backends): Don't clutter the backtrace with
+ '(:restartable :unknown). For practical purposes :unknown is the
+ same as nil.
+
+ * slime.el (sldb-compute-frame-face): Only accept nil or t for
+ the :restartable prop.
+
2008-10-16 Helmut Eller <heller@common-lisp.net>
* swank-backend.lisp (swank-compile-file): Return the same
View
@@ -6876,7 +6876,8 @@ If MORE is non-nil, more frames are on the Lisp stack."
(when more
(slime-insert-propertized
`(,@nil sldb-default-action sldb-fetch-more-frames
- sldb-previous-frame-number ,(sldb-frame.number (first (last frames)))
+ sldb-previous-frame-number
+ ,(sldb-frame.number (first (last frames)))
point-entered sldb-fetch-more-frames
start-open t
face sldb-section-face
@@ -6885,14 +6886,9 @@ If MORE is non-nil, more frames are on the Lisp stack."
(insert "\n")))
(defun sldb-compute-frame-face (frame)
- (let ((restartable (getf (sldb-frame.plist frame) :restartable)))
- (cond ((eq restartable 't)
- 'sldb-restartable-frame-line-face)
- ((eq restartable :unknown)
- 'sldb-frame-line-face)
- ((eq restartable 'nil)
- 'sldb-non-restartable-frame-line-face)
- (t (error "fall through")))))
+ (ecase (plist-get (sldb-frame.plist frame) :restartable)
+ ((nil) 'sldb-frame-line-face)
+ ((t) 'sldb-restartable-frame-line-face)))
(defun sldb-insert-frame (frame &optional face)
"Insert FRAME with FACE at point.
View
@@ -253,11 +253,11 @@
(defimplementation compute-backtrace (start end)
(let ((end (or end most-positive-fixnum)))
(loop for f in (subseq (backtrace-as-list-ignoring-swank-calls) start end)
- collect (make-swank-frame :%frame f :restartable :unknown))))
+ collect f)))
-(defimplementation print-swank-frame (frame stream)
+(defimplementation print-frame (frame stream)
(write-string (string-trim '(#\space #\newline)
- (prin1-to-string (swank-frame.%frame frame)))
+ (prin1-to-string frame))
stream))
(defimplementation frame-locals (index)
View
@@ -163,10 +163,10 @@
(let ((end (or end most-positive-fixnum)))
(loop for f = (nth-frame start) then (next-frame f)
for i from start below end
- while f collect (make-swank-frame :%frame f :restartable :unknown))))
+ while f collect f)))
-(defimplementation print-swank-frame (frame stream)
- (debugger:output-frame stream (swank-frame.%frame frame) :moderate))
+(defimplementation print-frame (frame stream)
+ (debugger:output-frame stream frame :moderate))
(defimplementation frame-locals (index)
(let ((frame (nth-frame index)))
@@ -210,6 +210,9 @@
form
(debugger:environment-of-frame frame)))))
+(defimplementation frame-restartable-p (frame)
+ (debugger:frame-retryable-p frame))
+
(defimplementation restart-frame (frame-number)
(let ((frame (nth-frame frame-number)))
(cond ((debugger:frame-retryable-p frame)
View
@@ -20,9 +20,6 @@
#:condition
#:severity
#:with-compilation-hooks
- #:swank-frame
- #:swank-frame-p
- #:swank-frame.restartable
#:location
#:location-p
#:location-buffer
@@ -656,13 +653,9 @@ what the default implementation does."
;;; The following functions in this section are supposed to be called
;;; within the dynamic contour of CALL-WITH-DEBUGGING-ENVIRONMENT only.
-(defstruct (swank-frame (:conc-name swank-frame.))
- %frame
- restartable)
-
(definterface compute-backtrace (start end)
"Returns a backtrace of the condition currently being debugged,
-that is an ordered list consisting of swank-frames. ``Ordered list''
+that is an ordered list consisting of frames. ``Ordered list''
means that an integer I can be mapped back to the i-th frame of this
backtrace.
@@ -671,9 +664,14 @@ returned. Frame zero is defined as the frame which invoked the
debugger. If END is nil, return the frames from START to the end of
the stack.")
-(definterface print-swank-frame (frame stream)
+(definterface print-frame (frame stream)
"Print frame to stream.")
+(definterface frame-restartable-p (frame)
+ "Is the frame FRAME restartable?.
+Return T if `restart-frame' can safely be called on the frame."
+ nil)
+
(definterface frame-source-location-for-emacs (frame-number)
"Return the source location for the frame associated to FRAME-NUMBER.")
View
@@ -349,7 +349,7 @@ Return NIL if the symbol is unbound."
(let* ((bt *sldb-backtrace*)
(len (length bt)))
(loop for f in (subseq bt start (min (or end len) len))
- collect (make-swank-frame :%frame f :restartable :unknown))))
+ collect f)))
;;; CLISP's REPL sets up an ABORT restart that kills SWANK. Here we
;;; can omit that restart so that users don't select it by mistake.
@@ -358,9 +358,8 @@ Return NIL if the symbol is unbound."
;; list, hopefully that's our unwanted ABORT restart.
(butlast (compute-restarts condition)))
-(defimplementation print-swank-frame (swank-frame stream)
- (let* ((frame (swank-frame.%frame swank-frame))
- (str (frame-to-string frame)))
+(defimplementation print-frame (frame stream)
+ (let* ((str (frame-to-string frame)))
(write-string (extract-frame-line str)
stream)))
View
@@ -1502,11 +1502,10 @@ A utility for debugging DEBUG-FUNCTION-ARGLIST."
(let ((end (or end most-positive-fixnum)))
(loop for f = (nth-frame start) then (frame-down f)
for i from start below end
- while f collect (make-swank-frame :%frame f :restartable :unknown))))
+ while f collect f)))
-(defimplementation print-swank-frame (swank-frame stream)
- (let ((frame (swank-frame.%frame swank-frame))
- (*standard-output* stream))
+(defimplementation print-frame (frame stream)
+ (let ((*standard-output* stream))
(handler-case
(debug::print-frame-call frame :verbosity 1 :number nil)
(error (e)
View
@@ -177,10 +177,10 @@
(defimplementation compute-backtrace (start end)
(loop for f in (subseq *stack-trace* start (min end (length *stack-trace*)))
- collect (make-swank-frame :%frame f :restartable :unknown)))
+ collect f))
-(defimplementation print-swank-frame (frame stream)
- (format stream "~S" (swank-frame.%frame frame)))
+(defimplementation print-frame (frame stream)
+ (format stream "~S" frame))
(defun get-frame-debug-info (frame)
(or (frame-debug-info frame)
@@ -370,9 +370,10 @@
(declare (ignore external-format))
(with-compilation-hooks ()
(let ((*buffer-name* nil))
- (compile-file *compile-filename*)
- (when load-p
- (load (compile-file-pathname *compile-filename*))))))
+ (multiple-value-bind (output-file warnings? failure?)
+ (compile-file *compile-filename*)
+ (values output-file warnings?
+ (or failure? (and load-p (load output-file))))))))
(defimplementation swank-compile-string (string &key buffer position directory
debug)
@@ -382,7 +383,8 @@
(*buffer-position* position)
(*buffer-string* string))
(funcall (compile nil (read-from-string
- (format nil "(~S () ~A)" 'lambda string)))))))
+ (format nil "(~S () ~A)" 'lambda string))))
+ t)))
;;;; Inspecting
View
@@ -316,7 +316,7 @@
(when (numberp end)
(setf end (min end (length *backtrace*))))
(loop for f in (subseq *backtrace* start end)
- collect (make-swank-frame :%frame f :restartable :unknown)))
+ collect f))
(defun frame-name (frame)
(let ((x (first frame)))
@@ -356,9 +356,8 @@
))))
(values functions blocks variables)))
-(defimplementation print-swank-frame (swank-frame stream)
- (let ((frame (swank-frame.%frame swank-frame)))
- (format stream "~A" (first frame))))
+(defimplementation print-frame (frame stream)
+ (format stream "~A" (first frame)))
(defimplementation frame-source-location-for-emacs (frame-number)
(nth-value 1 (frame-function (elt *backtrace* frame-number))))
View
@@ -318,8 +318,7 @@ Return NIL if the symbol is unbound."
((or (not frame) (= i end)) (nreverse backtrace))
(when (interesting-frame-p frame)
(incf i)
- (push (make-swank-frame :%frame frame :restartable :unknown)
- backtrace)))))
+ (push frame backtrace)))))
(defun frame-actual-args (frame)
(let ((*break-on-signals* nil))
@@ -331,13 +330,12 @@ Return NIL if the symbol is unbound."
(error (e) (format nil "<~A>" arg))))))
(dbg::call-frame-arglist frame))))
-(defimplementation print-swank-frame (swank-frame stream)
- (let ((frame (swank-frame.%frame swank-frame)))
- (cond ((dbg::call-frame-p frame)
- (format stream "~S ~S"
- (dbg::call-frame-function-name frame)
- (frame-actual-args frame)))
- (t (princ frame stream)))))
+(defimplementation print-frame (frame stream)
+ (cond ((dbg::call-frame-p frame)
+ (format stream "~S ~S"
+ (dbg::call-frame-function-name frame)
+ (frame-actual-args frame)))
+ (t (princ frame stream))))
(defun frame-vars (frame)
(first (dbg::frame-locals-format-list frame #'list 75 0)))
View
@@ -492,19 +492,17 @@ condition."
(let (result)
(map-backtrace (lambda (frame-number p context lfun pc)
(declare (ignore frame-number))
- (push (make-swank-frame :%frame (list :openmcl-frame p context lfun pc)
- :restartable :unknown)
+ (push (list :frame p context lfun pc)
result))
start-frame-number end-frame-number)
(nreverse result)))
-(defimplementation print-swank-frame (swank-frame stream)
- (let ((frame (swank-frame.%frame swank-frame)))
- (assert (eq (first frame) :openmcl-frame))
- (destructuring-bind (p context lfun pc) (rest frame)
- (format stream "(~S~{ ~S~})"
- (or (ccl::function-name lfun) lfun)
- (frame-arguments p context lfun pc)))))
+(defimplementation print-frame (frame stream)
+ (assert (eq (first frame) :frame))
+ (destructuring-bind (p context lfun pc) (rest frame)
+ (format stream "(~S~{ ~S~})"
+ (or (ccl::function-name lfun) lfun)
+ (frame-arguments p context lfun pc)))))
(defimplementation frame-locals (index)
(block frame-locals
@@ -963,7 +961,7 @@ out IDs for.")
(nconc (ldiff q tail) (cdr tail)))
(return (car tail)))))
(when (eq timeout t) (return (values nil t)))
- (ccl:timed-wait-on-semaphore (mailbox.semaphore mbox) 0.2))))
+ (ccl:timed-wait-on-semaphore (mailbox.semaphore mbox) 1))))
(defimplementation quit-lisp ()
(ccl::quit))
View
@@ -882,16 +882,14 @@ stack."
(let ((end (or end most-positive-fixnum)))
(loop for f = (nth-frame start) then (sb-di:frame-down f)
for i from start below end
- while f collect (make-swank-frame
- :%frame f
- :restartable (frame-restartable-p f)))))
+ while f collect f)))
-(defimplementation print-swank-frame (swank-frame stream)
- (sb-debug::print-frame-call (swank-frame.%frame swank-frame) stream))
+(defimplementation print-frame (frame stream)
+ (sb-debug::print-frame-call frame stream))
-(defun frame-restartable-p (frame)
+(defimplementation frame-restartable-p (frame)
#+#.(swank-backend::sbcl-with-restart-frame)
- (sb-debug:frame-has-debug-tag-p frame))
+ (not (null (sb-debug:frame-has-debug-tag-p frame))))
;;;; Code-location -> source-location translation
View
@@ -1354,11 +1354,10 @@ Signal an error if no constructor can be found."
(let ((end (or end most-positive-fixnum)))
(loop for f = (nth-frame start) then (frame-down f)
for i from start below end
- while f collect (make-swank-frame :%frame f :restartable :unknown))))
+ while f collect f)))
-(defimplementation print-swank-frame (swank-frame stream)
- (let ((frame (swank-frame.%frame swank-frame))
- (*standard-output* stream))
+(defimplementation print-frame (frame stream)
+ (let ((*standard-output* stream))
(handler-case
(debug::print-frame-call frame :verbosity 1 :number nil)
(error (e)
View
@@ -2294,21 +2294,21 @@ format suitable for Emacs."
I is an integer, and can be used to reference the corresponding frame
from Emacs; FRAME is a string representation of an implementation's
frame."
- (flet ((print-swank-frame-to-string (frame)
- (call/truncated-output-to-string
- 100
- (lambda (stream)
- (handler-case
- (with-bindings *backtrace-printer-bindings*
- (print-swank-frame frame stream))
- (t ()
- (format stream "[error printing frame]")))))))
- (loop for frame in (compute-backtrace start end)
- for i from start collect
- (list i (print-swank-frame-to-string frame)
- (list :restartable (let ((r (swank-frame.restartable frame)))
- (check-type r (member nil t :unknown))
- r))))))
+ (loop for frame in (compute-backtrace start end)
+ for i from start collect
+ (list* i (frame-to-string frame)
+ (ecase (frame-restartable-p frame)
+ ((nil) nil)
+ ((t) `((:restartable t)))))))
+
+(defun frame-to-string (frame)
+ (with-bindings *backtrace-printer-bindings*
+ (call/truncated-output-to-string
+ (* (or *print-lines* 1) (or *print-right-margin* 100))
+ (lambda (stream)
+ (handler-case (print-frame frame stream)
+ (serious-condition ()
+ (format stream "[error printing frame]")))))))
(defslimefun debugger-info-for-emacs (start end)
"Return debugger state, with stack frames from START to END.

0 comments on commit 954bd86

Please sign in to comment.