From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.devel Subject: Re: debug-on-entry Date: Mon, 13 Jun 2005 11:25:50 +0200 Message-ID: <87y89efw0x.fsf@xs4all.nl> References: <200506110344.j5B3ivw05989@raven.dms.auburn.edu> <87zmtxv0j2.fsf@xs4all.nl> <87k6kz8rjj.fsf-monnier+emacs@gnu.org> <87br6bnuvq.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 1118658005 10651 80.91.229.2 (13 Jun 2005 10:20:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 13 Jun 2005 10:20:05 +0000 (UTC) Cc: Luc Teirlinck , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 13 12:20:02 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dhm2V-0004U3-Gx for ged-emacs-devel@m.gmane.org; Mon, 13 Jun 2005 12:19:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dhm0w-0008W4-Hr for ged-emacs-devel@m.gmane.org; Mon, 13 Jun 2005 06:17:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DhlHf-0007yU-6a for emacs-devel@gnu.org; Mon, 13 Jun 2005 05:31:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DhlHb-0007wZ-Tg for emacs-devel@gnu.org; Mon, 13 Jun 2005 05:31:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DhlEs-00070G-U7 for emacs-devel@gnu.org; Mon, 13 Jun 2005 05:28:15 -0400 Original-Received: from [194.109.24.22] (helo=smtp-vbr2.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DhlDo-0003l0-Ki for emacs-devel@gnu.org; Mon, 13 Jun 2005 05:27:09 -0400 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr2.xs4all.nl (8.13.3/8.13.3) with ESMTP id j5D9Pp36066343; Mon, 13 Jun 2005 11:25:51 +0200 (CEST) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1DhlCY-0007kf-00; Mon, 13 Jun 2005 11:25:50 +0200 Original-To: Stefan Monnier In-Reply-To: <87br6bnuvq.fsf@xs4all.nl> (Lute Kamstra's message of "Sun, 12 Jun 2005 23:11:05 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 96 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 Xref: news.gmane.org gmane.emacs.devel:38704 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:38704 Lute Kamstra writes: >>> You can use debug-on-entry for primitive functions that are not >>> specials forms. You just can't step through them. I'll fix the >>> docs. >> >> Also they may be called without triggering the debugger, if they're called >> directly from C rather than from elisp. I.e. it's unreliable (but can >> still be useful, I guess). > > I'll point that out. What about the patch below? Lute. Index: lisp/emacs-lisp/debug.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/debug.el,v retrieving revision 1.85 diff -c -r1.85 debug.el *** lisp/emacs-lisp/debug.el 13 Jun 2005 08:13:16 -0000 1.85 --- lisp/emacs-lisp/debug.el 13 Jun 2005 09:23:19 -0000 *************** *** 656,665 **** ;;;###autoload (defun debug-on-entry (function) "Request FUNCTION to invoke debugger each time it is called. When called interactively, prompt for FUNCTION in the minibuffer. ! If you tell the debugger to continue, FUNCTION's execution proceeds. ! This works by modifying the definition of FUNCTION, ! which must be written in Lisp, not predefined. Use \\[cancel-debug-on-entry] to cancel the effect of this command. Redefining FUNCTION also cancels it." (interactive "aDebug on entry (to function): ") --- 656,671 ---- ;;;###autoload (defun debug-on-entry (function) "Request FUNCTION to invoke debugger each time it is called. + When called interactively, prompt for FUNCTION in the minibuffer. ! ! This works by modifying the definition of FUNCTION. If you tell the ! debugger to continue, FUNCTION's execution proceeds. If FUNCTION is a ! normal function or a macro written in Lisp, you can also step through ! its execution. FUNCTION can also be a primitive that is not a special ! form, in which case stepping is not possible. Break-on-entry for ! primitive functions only works when that function is called from Lisp. ! Use \\[cancel-debug-on-entry] to cancel the effect of this command. Redefining FUNCTION also cancels it." (interactive "aDebug on entry (to function): ") Index: lispref/debugging.texi =================================================================== RCS file: /cvsroot/emacs/emacs/lispref/debugging.texi,v retrieving revision 1.31 diff -c -r1.31 debugging.texi *** lispref/debugging.texi 11 Jun 2005 23:42:13 -0000 1.31 --- lispref/debugging.texi 13 Jun 2005 09:23:20 -0000 *************** *** 210,224 **** function, and then step through its caller. @deffn Command debug-on-entry function-name ! This function requests @var{function-name} to invoke the debugger each time ! it is called. It works by inserting the form @code{(debug 'debug)} into ! the function definition as the first form. ! ! Any function defined as Lisp code may be set to break on entry, ! regardless of whether it is interpreted code or compiled code. If the ! function is a command, it will enter the debugger when called from Lisp ! and when called interactively (after the reading of the arguments). You ! can't debug primitive functions (i.e., those written in C) this way. When @code{debug-on-entry} is called interactively, it prompts for @var{function-name} in the minibuffer. If the function is already set --- 210,227 ---- function, and then step through its caller. @deffn Command debug-on-entry function-name ! This function requests @var{function-name} to invoke the debugger each ! time it is called. It works by inserting the form ! @code{(implement-debug-on-entry)} into the function definition as the ! first form. ! ! Any function or macro defined as Lisp code may be set to break on ! entry, regardless of whether it is interpreted code or compiled code. ! If the function is a command, it will enter the debugger when called ! from Lisp and when called interactively (after the reading of the ! arguments). You can also debug primitive functions (i.e., those ! written in C) that are not special forms this way, but the primitive ! will only break on entry when it is called from Lisp. When @code{debug-on-entry} is called interactively, it prompts for @var{function-name} in the minibuffer. If the function is already set