changeset 43134:ecd029f63cc0

(debugger-frame-offset): Var deleted. (debugger-frame-number): Figure out the offset directly. (debugger-setup-buffer): Don't use debugger-frame-offset. (debugger-frame, debugger-frame-clear): Likewise. (debugger-jump): Don't alter debugger-frame-offset.
author Richard M. Stallman <rms@gnu.org>
date Wed, 06 Feb 2002 15:36:41 +0000
parents c929176c272b
children 10b506b00785
files lisp/emacs-lisp/debug.el
diffstat 1 files changed, 12 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/debug.el	Wed Feb 06 15:33:23 2002 +0000
+++ b/lisp/emacs-lisp/debug.el	Wed Feb 06 15:36:41 2002 +0000
@@ -272,12 +272,13 @@
 		    (cdr debugger-args) debugger-args)
 		(current-buffer))
 	 (insert ?\n)))
-  (when (re-search-forward "^  eval-buffer(" nil t)
-    (end-of-line)
-    (insert (format "\n  ;;; Reading at buffer position %d"
-		    (let ((level (+ (debugger-frame-number)
-				    debugger-frame-offset -4)))
-		      (with-current-buffer (nth 2 (backtrace-frame level))
+  ;; After any frame that uses eval-buffer,
+  ;; insert a line that states the buffer position it's reading at.
+  (save-excursion
+    (while (re-search-forward "^  eval-buffer(" nil t)
+      (end-of-line)
+      (insert (format "\n  ;;; Reading at buffer position %d"
+		      (with-current-buffer (nth 2 (backtrace-frame (debugger-frame-number)))
 			(point))))))
   (debugger-make-xrefs))
 
@@ -375,19 +376,10 @@
   (prin1 debugger-value)
   (exit-recursive-edit))
 
-;; Chosen empirically to account for all the frames
-;; that will exist when debugger-frame is called
-;; within the first one that appears in the backtrace buffer.
-;; Assumes debugger-frame is called from a key;
-;; will be wrong if it is called with Meta-x.
-(defconst debugger-frame-offset 8 "")
-
 (defun debugger-jump ()
   "Continue to exit from this frame, with all debug-on-entry suspended."
   (interactive)
-  ;; Compensate for the two extra stack frames for debugger-jump.
-  (let ((debugger-frame-offset (+ debugger-frame-offset 2)))
-    (debugger-frame))
+  (debugger-frame)
   ;; Turn off all debug-on-entry functions
   ;; but leave them in the list.
   (let ((list debug-function-list))
@@ -414,6 +406,8 @@
     (beginning-of-line)
     (let ((opoint (point))
 	  (count 0))
+      (while (not (eq (cadr (backtrace-frame count)) 'debug))
+	(setq count (1+ count)))
       (goto-char (point-min))
       (if (or (equal (buffer-substring (point) (+ (point) 6))
 		     "Signal")
@@ -444,8 +438,7 @@
     (if (looking-at " *;;;\\|[a-z]")
 	(error "This line is not a function call")))
   (beginning-of-line)
-  (let ((level (debugger-frame-number)))
-    (backtrace-debug (+ level debugger-frame-offset) t))
+  (backtrace-debug (debugger-frame-number) t)
   (if (= (following-char) ? )
       (let ((buffer-read-only nil))
 	(delete-char 1)
@@ -461,8 +454,7 @@
     (if (looking-at " *;;;\\|[a-z]")
 	(error "This line is not a function call")))
   (beginning-of-line)
-  (let ((level (debugger-frame-number)))
-    (backtrace-debug (+ level debugger-frame-offset) nil))
+  (backtrace-debug (debugger-frame-number) nil)
   (if (= (following-char) ?*)
       (let ((buffer-read-only nil))
 	(delete-char 1)