(princ (backtrace-to-string (backtrace-get-frames 'backtrace)))
nil)
-(defun backtrace-to-string(&optional frames)
+(defun backtrace-to-string (&optional frames)
"Format FRAMES, a list of `backtrace-frame' objects, for output.
Return the result as a string. If FRAMES is nil, use all
function calls currently active."
- (unless frames (setq frames (backtrace-get-frames 'backtrace-to-string)))
+ (substring-no-properties
+ (backtrace--to-string
+ (or frames (backtrace-get-frames 'backtrace-to-string)))))
+
+(defun backtrace--to-string (frames)
(let ((backtrace-fontify nil))
(with-temp-buffer
(backtrace-mode)
backtrace-frames frames
backtrace-print-function #'cl-prin1)
(backtrace-print)
- (substring-no-properties (filter-buffer-substring (point-min)
- (point-max))))))
+ (filter-buffer-substring (point-min) (point-max)))))
(provide 'backtrace)
(message "Error in debug printer: %S" err)
(prin1 obj stream))))
+(make-obsolete 'debugger-insert-backtrace
+ "use a `backtrace-mode' buffer or `backtrace-to-string'."
+ "Emacs 27.1")
+
+(defun debugger-insert-backtrace (frames do-xrefs)
+ "Format and insert the backtrace FRAMES at point.
+Make functions into cross-reference buttons if DO-XREFS is non-nil."
+ (insert (if do-xrefs
+ (backtrace--to-string frames)
+ (backtrace-to-string frames))))
+
(defun debugger-setup-buffer (args)
"Initialize the `*Backtrace*' buffer for entry to the debugger.
That buffer should be current already and in debugger-mode."
(let ((str (eval-expression-print-format val)))
(if str (princ str t))))))))
+(defalias 'debugger-toggle-locals 'backtrace-toggle-locals)
+
\f
(defvar debugger-mode-map
(let ((map (make-keymap)))
(buffer-substring (line-beginning-position 0)
(line-end-position 0)))))
+(defalias 'debug-help-follow 'backtrace-help-follow-symbol)
+
\f
;; When you change this, you may also need to change the number of
;; frames that the debugger skips.