unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* debug-on-entry
@ 2005-06-11  3:44 Luc Teirlinck
  2005-06-11  7:02 ` debug-on-entry Lute Kamstra
  0 siblings, 1 reply; 7+ messages in thread
From: Luc Teirlinck @ 2005-06-11  3:44 UTC (permalink / raw)


Are the claims in the Elisp manual and in the debug-on-entry docstring
that debug-on-entry does not work for primitive functions still valid?

I tried it on select-frame, a primitive function, and possibly one can
not get all features, but a least I got a backtrace buffer.

Sincerely,

Luc.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: debug-on-entry
  2005-06-11  3:44 debug-on-entry Luc Teirlinck
@ 2005-06-11  7:02 ` Lute Kamstra
  2005-06-12 16:33   ` debug-on-entry Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Lute Kamstra @ 2005-06-11  7:02 UTC (permalink / raw)
  Cc: emacs-devel

Luc Teirlinck <teirllm@dms.auburn.edu> writes:

> Are the claims in the Elisp manual and in the debug-on-entry docstring
> that debug-on-entry does not work for primitive functions still valid?
>
> I tried it on select-frame, a primitive function, and possibly one can
> not get all features, but a least I got a backtrace buffer.

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.

Thanks for noticing,

  Lute.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: debug-on-entry
  2005-06-11  7:02 ` debug-on-entry Lute Kamstra
@ 2005-06-12 16:33   ` Stefan Monnier
  2005-06-12 21:11     ` debug-on-entry Lute Kamstra
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2005-06-12 16:33 UTC (permalink / raw)
  Cc: Luc Teirlinck, emacs-devel

> 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).


        Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: debug-on-entry
  2005-06-12 16:33   ` debug-on-entry Stefan Monnier
@ 2005-06-12 21:11     ` Lute Kamstra
  2005-06-13  9:25       ` debug-on-entry Lute Kamstra
  0 siblings, 1 reply; 7+ messages in thread
From: Lute Kamstra @ 2005-06-12 21:11 UTC (permalink / raw)
  Cc: Luc Teirlinck, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> 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.

Thanks,

  Lute.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: debug-on-entry
  2005-06-12 21:11     ` debug-on-entry Lute Kamstra
@ 2005-06-13  9:25       ` Lute Kamstra
  2005-06-13 18:15         ` debug-on-entry Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Lute Kamstra @ 2005-06-13  9:25 UTC (permalink / raw)
  Cc: Luc Teirlinck, emacs-devel

Lute Kamstra <Lute.Kamstra.lists@xs4all.nl> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: debug-on-entry
  2005-06-13  9:25       ` debug-on-entry Lute Kamstra
@ 2005-06-13 18:15         ` Richard Stallman
  2005-06-14 11:38           ` debug-on-entry Lute Kamstra
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2005-06-13 18:15 UTC (permalink / raw)
  Cc: teirllm, monnier, emacs-devel

These doc changes are good overall, except.

      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.

That's not very clear about how special forms are treated.  This is
clearer:

      You can also set debug-on-entry for primitive functions (i.e., those
      written in C) this way, but it only takes effect when the primitive
      is called from Lisp code.  Debug-on-entry is not allowed for 
      special forms.

With that change, please install it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: debug-on-entry
  2005-06-13 18:15         ` debug-on-entry Richard Stallman
@ 2005-06-14 11:38           ` Lute Kamstra
  0 siblings, 0 replies; 7+ messages in thread
From: Lute Kamstra @ 2005-06-14 11:38 UTC (permalink / raw)
  Cc: teirllm, monnier, emacs-devel

Richard Stallman <rms@gnu.org> writes:

> With that change, please install it.

Done.

Lute.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-06-14 11:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-11  3:44 debug-on-entry Luc Teirlinck
2005-06-11  7:02 ` debug-on-entry Lute Kamstra
2005-06-12 16:33   ` debug-on-entry Stefan Monnier
2005-06-12 21:11     ` debug-on-entry Lute Kamstra
2005-06-13  9:25       ` debug-on-entry Lute Kamstra
2005-06-13 18:15         ` debug-on-entry Richard Stallman
2005-06-14 11:38           ` debug-on-entry Lute Kamstra

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).