emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lisp debugger problems.


From: Lute Kamstra
Subject: Re: Lisp debugger problems.
Date: Tue, 01 Mar 2005 15:50:28 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

>     What I don't understand in why debug-on-entry and
>     cancel-debug-on-entry call debugger-reenable as well (thus causing the
>     strange behavior in the example above).  What am I missing?
>
> I am not certain.  Perhaps the idea was in case you do
> debugger-jump but you don't reenter the debugger.
> In that case, debugger entry would be turned off permanently
> in those functions.
>
> If so, this solution is just a half measure.  We really should arrange
> to reenable debugger entry for these functions whenever control gets
> back to the command level outside the debugger.  This could be done
> by frobbing post-command-hook somehow.

Something like this?

Lute.


Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.7045
diff -c -r1.7045 ChangeLog
*** lisp/ChangeLog      1 Mar 2005 13:02:37 -0000       1.7045
--- lisp/ChangeLog      1 Mar 2005 14:47:18 -0000
***************
*** 1,6 ****
  2005-03-01  Robert J. Chassell  <address@hidden>
  
!       * textmodes/texinfmt.el: (texinfo-no-refill-regexp): Comment out
        inclusion of "itemize\\|", which may be unnecessary, is certainly
        inelegant, and stops refilling in itemize lists when formatting
        Japanese Texinfo files to Info.
--- 1,18 ----
+ 2005-03-01  Lute Kamstra  <address@hidden>
+ 
+       * emacs-lisp/debug.el (inhibit-debug-on-entry): Add docstring.
+       (debugger-jumping-flag): New var.
+       (debug-entry-code): Use it.
+       (debugger-jump): Use debugger-jumping-flag and add
+       debugger-reenable to post-command-hook.
+       (debugger-reenable): Use debugger-jumping-flag and remove itself
+       from post-command-hook.
+       (debug, debug-on-entry, cancel-debug-on-entry): Remove call to
+       debugger-reenable.
+ 
  2005-03-01  Robert J. Chassell  <address@hidden>
  
!       * textmodes/texinfmt.el (texinfo-no-refill-regexp): Comment out
        inclusion of "itemize\\|", which may be unnecessary, is certainly
        inelegant, and stops refilling in itemize lists when formatting
        Japanese Texinfo files to Info.
Index: lisp/emacs-lisp/debug.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/debug.el,v
retrieving revision 1.70
diff -c -r1.70 debug.el
*** lisp/emacs-lisp/debug.el    1 Mar 2005 13:00:30 -0000       1.70
--- lisp/emacs-lisp/debug.el    1 Mar 2005 14:47:19 -0000
***************
*** 93,103 ****
  (defvar debugger-outer-inhibit-redisplay)
  (defvar debugger-outer-cursor-in-echo-area)
  
! (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
--- 93,111 ----
  (defvar debugger-outer-inhibit-redisplay)
  (defvar debugger-outer-cursor-in-echo-area)
  
! (defvar inhibit-debug-on-entry nil
!   "Non-nil means that debug-on-entry is disabled.")
! 
! (defvar debugger-jumping-flag nil
!   "Non-nil means that debug-on-entry is disabled.
! This variable is used by `debugger-jump' and `debugger-reenable'.")
  
  ;; When you change this, you may also need to change the number of
  ;; frames that the debugger skips.
! (defconst debug-entry-code
!   '(if (or inhibit-debug-on-entry debugger-jumping-flag)
!        nil
!      (debug 'debug))
    "Code added to a function to cause it to call the debugger upon entry.")
  
  ;;;###autoload
***************
*** 197,203 ****
                    ;; Skip the frames for backtrace-debug, byte-code,
                    ;; and debug-entry-code.
                    (backtrace-debug 4 t))
-               (debugger-reenable)
                (message "")
                (let ((standard-output nil)
                      (buffer-read-only t))
--- 205,210 ----
***************
*** 406,430 ****
    "Continue to exit from this frame, with all debug-on-entry suspended."
    (interactive)
    (debugger-frame)
!   ;; Turn off all debug-on-entry functions
!   ;; but leave them in the list.
!   (let ((list debug-function-list))
!     (while list
!       (fset (car list)
!           (debug-on-entry-1 (car list) (symbol-function (car list)) nil))
!       (setq list (cdr list))))
    (message "Continuing through this frame")
    (exit-recursive-edit))
  
  (defun debugger-reenable ()
!   "Turn all debug-on-entry functions back on."
!   (let ((list debug-function-list))
!     (while list
!       (or (consp (symbol-function (car list)))
!         (debug-convert-byte-code (car list)))
!       (fset (car list)
!           (debug-on-entry-1 (car list) (symbol-function (car list)) t))
!       (setq list (cdr list)))))
  
  (defun debugger-frame-number ()
    "Return number of frames in backtrace before the one point points at."
--- 413,429 ----
    "Continue to exit from this frame, with all debug-on-entry suspended."
    (interactive)
    (debugger-frame)
!   (setq debugger-jumping-flag t)
!   (add-hook 'post-command-hook 'debugger-reenable)
    (message "Continuing through this frame")
    (exit-recursive-edit))
  
  (defun debugger-reenable ()
!   "Turn all debug-on-entry functions back on.
! This function is put on `post-command-hook' by `debugger-jump' and
! removes itself from that hook."
!   (setq debugger-jumping-flag nil)
!   (remove-hook 'post-command-hook 'debugger-reenable))
  
  (defun debugger-frame-number ()
    "Return number of frames in backtrace before the one point points at."
***************
*** 634,640 ****
  Use \\[cancel-debug-on-entry] to cancel the effect of this command.
  Redefining FUNCTION also cancels it."
    (interactive "aDebug on entry (to function): ")
-   (debugger-reenable)
    ;; Handle a function that has been aliased to some other function.
    (if (and (subrp (symbol-function function))
           (eq (cdr (subr-arity (symbol-function function))) 'unevalled))
--- 633,638 ----
***************
*** 665,671 ****
                                 (mapcar 'symbol-name debug-function-list)
                                 nil t nil)))
           (if name (intern name)))))
-   (debugger-reenable)
    (if (and function (not (string= function "")))
        (progn
        (let ((f (debug-on-entry-1 function (symbol-function function) nil)))
--- 663,668 ----
Index: lispref/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lispref/ChangeLog,v
retrieving revision 1.321
diff -c -r1.321 ChangeLog
*** lispref/ChangeLog   1 Mar 2005 08:42:23 -0000       1.321
--- lispref/ChangeLog   1 Mar 2005 14:47:22 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2005-03-01  Lute Kamstra  <address@hidden>
+ 
+       * debugging.texi (Debugger Commands): Update `j'.
+ 
  2005-02-28  Lute Kamstra  <address@hidden>
  
        * debugging.texi (Debugging): Fix typo.
Index: lispref/debugging.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/lispref/debugging.texi,v
retrieving revision 1.26
diff -c -r1.26 debugging.texi
*** lispref/debugging.texi      1 Mar 2005 08:41:52 -0000       1.26
--- lispref/debugging.texi      1 Mar 2005 14:47:23 -0000
***************
*** 388,398 ****
  @item j
  Flag the current frame like @kbd{b}.  Then continue execution like
  @kbd{c}, but temporarily disable break-on-entry for all functions that
! are set up to do so by @code{debug-on-entry}.  The temporarily disabled
! functions are set up to debug on entry again when the debugger is
! entered or when @code{debug-on-entry} is called;
! @code{cancel-debug-on-entry} also re-enables these functions before it
! disables any functions that its argument says it should disable.
  
  @item e
  Read a Lisp expression in the minibuffer, evaluate it, and print the
--- 388,394 ----
  @item j
  Flag the current frame like @kbd{b}.  Then continue execution like
  @kbd{c}, but temporarily disable break-on-entry for all functions that
! are set up to do so by @code{debug-on-entry}.
  
  @item e
  Read a Lisp expression in the minibuffer, evaluate it, and print the




reply via email to

[Prev in Thread] Current Thread [Next in Thread]