(setq debug-on-next-call debugger-step-after-exit)
debugger-value)))
\f
+(defun debugger--print (obj &optional stream)
+ (condition-case err
+ (funcall debugger-print-function obj stream)
+ (error
+ (message "Error in debug printer: %S" err)
+ (prin1 obj stream))))
(defun debugger-insert-backtrace (frames do-xrefs)
"Format and insert the backtrace FRAMES at point.
(fun-pt (point)))
(cond
((and evald (not debugger-stack-frame-as-list))
- (funcall debugger-print-function fun)
- (if args (funcall debugger-print-function args) (princ "()")))
+ (debugger--print fun)
+ (if args (debugger--print args) (princ "()")))
(t
- (funcall debugger-print-function (cons fun args))
+ (debugger--print (cons fun args))
(cl-incf fun-pt)))
(when fun-file
(make-text-button fun-pt (+ fun-pt (length (symbol-name fun)))
(insert "--returning value: ")
(setq pos (point))
(setq debugger-value (nth 1 args))
- (funcall debugger-print-function debugger-value (current-buffer))
+ (debugger--print debugger-value (current-buffer))
(setf (cl-getf (nth 3 (car frames)) :debug-on-exit) nil)
(insert ?\n))
;; Watchpoint triggered.
(`error
(insert "--Lisp error: ")
(setq pos (point))
- (funcall debugger-print-function (nth 1 args) (current-buffer))
+ (debugger--print (nth 1 args) (current-buffer))
(insert ?\n))
;; debug-on-call, when the next thing is an eval.
(`t
(_
(insert ": ")
(setq pos (point))
- (funcall debugger-print-function
+ (debugger--print
(if (eq (car args) 'nil)
(cdr args) args)
(current-buffer))