Function: debugger--insert-header
debugger--insert-header is a byte-compiled function defined in
debug.el.gz.
Signature
(debugger--insert-header ARGS)
Documentation
Insert the header for the debugger's Backtrace buffer.
Include the reason for debugger entry from ARGS.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/debug.el.gz
(defun debugger--insert-header (args)
"Insert the header for the debugger's Backtrace buffer.
Include the reason for debugger entry from ARGS."
(insert "Debugger entered")
(pcase (car args)
;; lambda is for debug-on-call when a function call is next.
;; debug is for debug-on-entry function called.
((or 'lambda 'debug)
(insert "--entering a function:\n"))
;; Exiting a function.
('exit
(insert "--returning value: ")
(insert (backtrace-print-to-string debugger-value))
(insert ?\n))
;; Watchpoint triggered.
((and 'watchpoint (let `(,symbol ,newval . ,details) (cdr args)))
(insert
"--"
(pcase details
('(makunbound nil) (format "making %s void" symbol))
(`(makunbound ,buffer) (format "killing local value of %s in buffer %s"
symbol buffer))
(`(defvaralias ,_) (format "aliasing %s to %s" symbol newval))
(`(let ,_) (format "let-binding %s to %s" symbol
(backtrace-print-to-string newval)))
(`(unlet ,_) (format "ending let-binding of %s" symbol))
('(set nil) (format "setting %s to %s" symbol
(backtrace-print-to-string newval)))
(`(set ,buffer) (format "setting %s in buffer %s to %s"
symbol buffer
(backtrace-print-to-string newval)))
(_ (error "Unrecognized watchpoint triggered %S" (cdr args))))
": ")
(insert ?\n))
;; Debugger entered for an error.
('error
(insert "--Lisp error: ")
(insert (backtrace-print-to-string (nth 1 args)))
(insert ?\n))
;; debug-on-call, when the next thing is an eval.
('t
(insert "--beginning evaluation of function call form:\n"))
;; User calls debug directly.
(_
(insert ": ")
(insert (backtrace-print-to-string (if (eq (car args) 'nil)
(cdr args) args)))
(insert ?\n))))