Mercurial > emacs
changeset 60329:d913e02f38ae
(debug): Skip one more frame in case of debug on entry.
(debugger-setup-buffer): Delete one more frame line in case of debug
on entry.
(debugger-frame-number): Update to use the new text introduced by the
1999-11-03 change. Skip one more frame in case of debug on entry.
author | Lute Kamstra <lute@gnu.org> |
---|---|
date | Tue, 01 Mar 2005 13:00:30 +0000 |
parents | ebb1fcafaa50 |
children | cc5cbe6d0463 |
files | lisp/emacs-lisp/debug.el |
diffstat | 1 files changed, 18 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emacs-lisp/debug.el Tue Mar 01 12:44:51 2005 +0000 +++ b/lisp/emacs-lisp/debug.el Tue Mar 01 13:00:30 2005 +0000 @@ -95,6 +95,11 @@ (defvar inhibit-debug-on-entry nil) +;; When you change this, you may also need to change the number of +;; frames that the debugger skips. +(defconst debug-entry-code '(if inhibit-debug-on-entry nil (debug 'debug)) + "Code added to a function to cause it to call the debugger upon entry.") + ;;;###autoload (setq debugger 'debug) ;;;###autoload @@ -189,8 +194,9 @@ (message "%s" (buffer-string)) (kill-emacs)) (if (eq (car debugger-args) 'debug) - ;; Skip the frames for backtrace-debug, byte-code, and debug. - (backtrace-debug 3 t)) + ;; Skip the frames for backtrace-debug, byte-code, + ;; and debug-entry-code. + (backtrace-debug 4 t)) (debugger-reenable) (message "") (let ((standard-output nil) @@ -253,7 +259,9 @@ (delete-region (point) (progn (search-forward "\n debug(") - (forward-line 1) + (forward-line (if (eq (car debugger-args) 'debug) + 2 ; Remove debug-entry-code frame. + 1)) (point))) (insert "Debugger entered") ;; lambda is for debug-on-call when a function call is next. @@ -426,14 +434,13 @@ (count 0)) (while (not (eq (cadr (backtrace-frame count)) 'debug)) (setq count (1+ count))) + ;; Skip debug-entry-code frame. + (when (member '(debug (quote debug)) (cdr (backtrace-frame (1+ count)))) + (setq count (1+ count))) (goto-char (point-min)) - (if (or (equal (buffer-substring (point) (+ (point) 6)) - "Signal") - (equal (buffer-substring (point) (+ (point) 6)) - "Return")) - (progn - (search-forward ":") - (forward-sexp 1))) + (when (looking-at "Debugger entered--\\(Lisp error\\|returning value\\):") + (goto-char (match-end 0)) + (forward-sexp 1)) (forward-line 1) (while (progn (forward-char 2) @@ -692,9 +699,6 @@ (setq body (cons (documentation function) body))) (fset function (cons 'lambda (cons (car contents) body))))))) -(defconst debug-entry-code '(if inhibit-debug-on-entry nil (debug 'debug)) - "Code added to a function to cause it to call the debugger upon entry.") - (defun debug-on-entry-1 (function defn flag) (if (subrp defn) (error "%s is a built-in function" function) @@ -707,7 +711,7 @@ (when (and (stringp (cadr tail)) (cddr tail)) (setq tail (cdr tail))) ;; Skip the interactive form. - (when (eq 'interactive (car-safe (cadr tail))) + (when (eq 'interactive (car-safe (cadr tail))) (setq tail (cdr tail))) (unless (eq flag (equal (cadr tail) debug-entry-code)) ;; Add/remove debug statement as needed.