From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.devel Subject: Re: Lisp debugger problems. Date: Tue, 01 Mar 2005 15:50:28 +0100 Message-ID: <87oee3v2rv.fsf@xs4all.nl> References: <878y5eke1b.fsf@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1109689757 5108 80.91.229.2 (1 Mar 2005 15:09:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 1 Mar 2005 15:09:17 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 01 16:09:16 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D68zi-0006tY-Ia for ged-emacs-devel@m.gmane.org; Tue, 01 Mar 2005 16:09:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D69II-0002tB-3B for ged-emacs-devel@m.gmane.org; Tue, 01 Mar 2005 10:28:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D69GP-0002HO-Fp for emacs-devel@gnu.org; Tue, 01 Mar 2005 10:26:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D69GN-0002Gx-M1 for emacs-devel@gnu.org; Tue, 01 Mar 2005 10:26:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D69Es-0001lT-U8 for emacs-devel@gnu.org; Tue, 01 Mar 2005 10:24:47 -0500 Original-Received: from [194.109.24.26] (helo=smtp-vbr6.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D68hh-0003rW-Pr; Tue, 01 Mar 2005 09:50:30 -0500 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr6.xs4all.nl (8.12.11/8.12.11) with ESMTP id j21EoSLd062664; Tue, 1 Mar 2005 15:50:28 +0100 (CET) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1D68hg-0002Vz-00; Tue, 01 Mar 2005 15:50:28 +0100 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Mon, 28 Feb 2005 06:26:00 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 215 X-Virus-Scanned: by XS4ALL Virus Scanner X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:33979 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33979 Richard Stallman 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 ! * 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 + + * 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 ! * 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 + + * debugging.texi (Debugger Commands): Update `j'. + 2005-02-28 Lute Kamstra * 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