4.4BSD/usr/src/contrib/emacs-18.57/lisp/debug.elc


(setq debugger (quote debug))

(defun debug (&rest debugger-args) "\
Enter debugger.  Returns if user says \"continue\".
Arguments are mainly for use when this is called
 from the internals of the evaluator.
You may call with no args, or you may
 pass nil as the first arg and any other args you like.
 In that case, the list of args after the first will 
 be printed into the backtrace buffer." (byte-code "! !)p
	َڋ)).	" [debugger-value debugger-match-data debug-on-error nil debug-on-quit debugger-buffer default-major-mode debugger-old-buffer debugger-step-after-exit executing-macro cursor-in-echo-area standard-output print-escape-newlines t print-length debugger-args inhibit-trace buffer-read-only debug-on-next-call message "Entering debugger..." match-data fundamental-mode generate-new-buffer "*Backtrace*" ((byte-code "!	!" [debugger-buffer debugger-match-data kill-buffer store-match-data] 3)) ((byte-code "! p +eb `!!`\"
@>Fc
@=C\"!c 
@=lc
8p\"c!c 
@=c
8p\"c
@=c
@=
A
p\"c!	! +" [debugger-buffer standard-output print-escape-newlines t print-length debugger-args debugger-value inhibit-trace nil buffer-read-only pop-to-buffer erase-buffer 50 backtrace debugger-mode delete-region forward-sexp 8 forward-line 1 (lambda debug) "Entering:
" debug backtrace-debug 4 delete-char 42 beginning-of-line exit "Return value: " prin1 10 32 error "Signalling: " "Beginning evaluation of function call form:
" message "" recursive-edit] 19))] 12))

(defun debugger-step-through nil "\
Proceed, stepping through subexpressions of this expression.
Enter another debugger on next entry to eval, apply or funcall." (interactive) (byte-code "ˆ! " [debugger-step-after-exit t nil message "Proceding, will debug on next eval or call." exit-recursive-edit] 3))

(defun debugger-continue nil "\
Continue, evaluating this expression without stopping." (interactive) (byte-code "! " [nil message "Continuing." exit-recursive-edit] 3))

(defun debugger-return-value (val) "\
Continue, specifying value to return.
This is only useful when the value returned from the debugger
will be used, such as in a debug on exit from a frame." (interactive "XReturn value (evaluated): ") (byte-code "È	\"! " [debugger-value val t nil princ "Returning " prin1 exit-recursive-edit] 4))

(defun debugger-frame-number nil "\
Return number of frames in backtrace before the one point points at." (byte-code " `eb``\\\"\" ``\\\"\"*!!!!gU?!B!!`XU	T/	*)" [opoint count beginning-of-line 0 equal buffer-substring 6 "Signal" "Return" search-forward ":" forward-sexp 1 forward-line forward-char 2 40] 15))

(defconst debugger-frame-offset 8 "\
")

(defun debugger-frame nil "\
Request entry to debugger when this frame exits.
Applies to the frame whose line point is on in the backtrace." (interactive) (byte-code "Ĉ  	\\\")gU!c) " [level debugger-frame-offset t buffer-read-only nil beginning-of-line debugger-frame-number backtrace-debug 32 delete-char 1 42] 6))

(defun debugger-frame-clear nil "\
Do not enter to debugger when this frame exits.
Applies to the frame whose line point is on in the backtrace." (interactive) (byte-code "ˆ  	\\\")gU!c) " [level debugger-frame-offset nil buffer-read-only beginning-of-line debugger-frame-number backtrace-debug 42 delete-char 1 32] 6))

(defun debugger-eval-expression (exp) (interactive "xEval: ") (byte-code "ˆ!?
pq	!)" [debugger-old-buffer exp nil buffer-name eval-expression] 3))

(defvar debugger-mode-map nil)

(if debugger-mode-map nil (let ((loop 32)) (setq debugger-mode-map (make-keymap)) (suppress-keymap debugger-mode-map) (define-key debugger-mode-map "-" (quote negative-argument)) (define-key debugger-mode-map "b" (quote debugger-frame)) (define-key debugger-mode-map "c" (quote debugger-continue)) (define-key debugger-mode-map "r" (quote debugger-return-value)) (define-key debugger-mode-map "u" (quote debugger-frame-clear)) (define-key debugger-mode-map "d" (quote debugger-step-through)) (define-key debugger-mode-map "h" (quote describe-mode)) (define-key debugger-mode-map "q" (quote top-level)) (define-key debugger-mode-map "e" (quote debugger-eval-expression)) (define-key debugger-mode-map " " (quote next-line))))

(put (quote debugger-mode) (quote mode-class) (quote special))

(defun debugger-mode nil "\
Mode for backtrace buffers, selected in debugger.
\\{debugger-mode-map}
For the r command, when in debugger due to frame being exited,
    the value specified here will be used as the value of that frame.

Note lines starting with * are frames that will
 enter debugger when exited." (byte-code " ljȉÉ!
!" [major-mode mode-name truncate-lines t emacs-lisp-mode-syntax-table debugger-mode-map kill-all-local-variables debugger-mode "Debugger" set-syntax-table use-local-map] 4))

(defun debug-on-entry (function) "\
Request FUNCTION to invoke debugger each time it is called.
If the user continues, FUNCTION's execution proceeds.
Works by modifying the definition of FUNCTION,
which must be written in Lisp, not predefined.
Use `cancel-debug-on-entry' to cancel the effect of this command.
Redefining FUNCTION also does that." (interactive "aDebug on entry (to function): ") (byte-code "È	K@=		A#BM 		#M)	" [defn function t nil macro debug-on-entry-1] 6))

(defun cancel-debug-on-entry (function) "\
Undoes effect of debug-on-entry on FUNCTION." (interactive "aCancel debug on entry (to function): ") (byte-code "ˆ	K@=		A#BM 		#M)	" [defn function nil macro debug-on-entry-1] 6))

(defun debug-on-entry-1 (function defn flag) (byte-code "@=	\"\"@;-\"@A@AA@E:\"@A@D
@\"=Ił[V
B\"[
A\"*" [defn function tail prec flag nil lambda error "%s not user-defined Lisp function." nthcdr 2 3 equal (debug (quote debug)) nconc (debug (quote debug))] 9))