aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/debug.el32
2 files changed, 24 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 651dd6fdbe..56097bb2cc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -35,6 +35,12 @@
new implementation no longer requires it. Make sure that a
function body containing just a string is not mistaken for a
docstring.
+ (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.
2005-02-28 Kim F. Storm <[email protected]>
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index fe642a276e..b637ead05e 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -95,6 +95,11 @@ This is to optimize `debugger-make-xrefs'.")
(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 @@ first will be printed into the backtrace buffer."
(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 @@ That buffer should be current already."
(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 @@ will be used, such as in a debug on exit from a frame."
(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 @@ If argument is nil or an empty string, cancel for all functions."
(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 @@ If argument is nil or an empty string, cancel for all functions."
(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.