0.pre8.100:
[sbcl.git] / contrib / sb-aclrepl / debug.lisp
1 ;;;; Debugger for sb-aclrepl
2 ;;;;
3 ;;;; The documentation, which may or may not apply in its entirety at
4 ;;;; any given time, for this functionality is on the ACL website:
5 ;;;;   <http://www.franz.com/support/documentation/6.2/doc/top-level.htm>.
6
7 (cl:in-package :sb-aclrepl)
8
9 (defun debugger (condition)
10   "Enter the debugger."
11   (print "Entering debugger")
12   (let ((old-hook *debugger-hook*))
13     (when old-hook
14       (let ((*debugger-hook* nil))
15         (funcall old-hook condition old-hook))))
16
17   (format t "~&Error: ~A~%" condition)
18   (format t "~&  [Condition type: ~A]~%" (type-of condition))
19   (format t "~%")
20   (format t "~&Restart actions (select using :continue)~%")
21   (let ((restarts (compute-restarts)))
22     (dotimes (i (length restarts))
23       (format t "~&~2D: ~A~%" i (nth i restarts)))
24     (new-break :restarts (cons condition restarts)))
25   (sb-impl::toplevel-repl nil))
26
27 ;(setq sb-debug::*invoke-debugger-fun* #'debugger)