]> code.delx.au - gnu-emacs/blobdiff - lispref/edebug.texi
Merged in changes from CVS HEAD
[gnu-emacs] / lispref / edebug.texi
index d06275bb9f72d0f881cf116ad19188e1cf9c3783..5520852c1a37fcf6dbe1919d0b0ab42c3615d243 100644 (file)
@@ -1,10 +1,10 @@
 @comment -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @comment -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1992, 1993, 1994, 1998 Free Software Foundation, Inc. 
+@c Copyright (C) 1992, 1993, 1994, 1998, 1999 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 
 @c See the file elisp.texi for copying conditions.
 
-@c This file can also be used by an independent Edebug User 
-@c Manual in which case the Edebug node below should be used 
+@c This file can also be used by an independent Edebug User
+@c Manual in which case the Edebug node below should be used
 @c with the following links to the Bugs section and to the top level:
 
 @c , Bugs and Todo List, Top, Top
 @c with the following links to the Bugs section and to the top level:
 
 @c , Bugs and Todo List, Top, Top
@@ -35,7 +35,7 @@ at each breakpoint.
 Display expression results and evaluate expressions as if outside of
 Edebug.
 
 Display expression results and evaluate expressions as if outside of
 Edebug.
 
-@item 
+@item
 Automatically re-evaluate a list of expressions and
 display their results each time Edebug updates the display.
 
 Automatically re-evaluate a list of expressions and
 display their results each time Edebug updates the display.
 
@@ -97,7 +97,7 @@ which stops execution.  @xref{Edebug Execution Modes}.
 
   Within Edebug, you normally view an Emacs buffer showing the source of
 the Lisp code you are debugging.  This is referred to as the @dfn{source
 
   Within Edebug, you normally view an Emacs buffer showing the source of
 the Lisp code you are debugging.  This is referred to as the @dfn{source
-code buffer}, and is is temporarily read-only.
+code buffer}, and it is temporarily read-only.
 
   An arrow at the left margin indicates the line where the function is
 executing.  Point initially shows where within the line the function is
 
   An arrow at the left margin indicates the line where the function is
 executing.  Point initially shows where within the line the function is
@@ -117,7 +117,7 @@ at the open-parenthesis before @code{if}.
 @cindex stop points
 The places within a function where Edebug can stop execution are called
 @dfn{stop points}.  These occur both before and after each subexpression
 @cindex stop points
 The places within a function where Edebug can stop execution are called
 @dfn{stop points}.  These occur both before and after each subexpression
-that is a list, and also after each variable reference.  
+that is a list, and also after each variable reference.
 Here we use periods to show the stop points in the function
 @code{fac}:
 
 Here we use periods to show the stop points in the function
 @code{fac}:
 
@@ -142,7 +142,7 @@ display you will see:
 @end example
 
 When Edebug stops execution after an expression, it displays the
 @end example
 
 When Edebug stops execution after an expression, it displays the
-expression's value in the echo area. 
+expression's value in the echo area.
 
 Other frequently used commands are @kbd{b} to set a breakpoint at a stop
 point, @kbd{g} to execute until a breakpoint is reached, and @kbd{q} to
 
 Other frequently used commands are @kbd{b} to set a breakpoint at a stop
 point, @kbd{g} to execute until a breakpoint is reached, and @kbd{q} to
@@ -257,7 +257,8 @@ Next: stop at the next stop point encountered after an expression
 @ref{Edebug Misc}.
 
 @item t
 @ref{Edebug Misc}.
 
 @item t
-Trace: pause one second at each Edebug stop point (@code{edebug-trace-mode}).
+Trace: pause (normally one second) at each Edebug stop point
+(@code{edebug-trace-mode}).
 
 @item T
 Rapid trace: update the display at each stop point, but don't actually
 
 @item T
 Rapid trace: update the display at each stop point, but don't actually
@@ -307,6 +308,10 @@ specifies step mode.  Note that you may reenter the same Edebug level
 several times if, for example, an instrumented function is called
 several times from one command.
 
 several times if, for example, an instrumented function is called
 several times from one command.
 
+@defopt edebug-sit-for-seconds
+This option specifies how many seconds to wait between execution steps
+in trace mode.  The default is 1 second.
+@end defopt
 
 @node Jumping
 @subsection Jumping
 
 @node Jumping
 @subsection Jumping
@@ -445,7 +450,7 @@ breakpoint is temporary---it turns off the first time it stops the
 program.
 
 @item u
 program.
 
 @item u
-Unset the breakpoint (if any) at the stop point at or after 
+Unset the breakpoint (if any) at the stop point at or after
 point (@code{edebug-unset-breakpoint}).
 
 @item x @var{condition} @key{RET}
 point (@code{edebug-unset-breakpoint}).
 
 @item x @var{condition} @key{RET}
@@ -490,7 +495,7 @@ breakpoints.  This command does not continue execution---it just moves
 point in the buffer.
 
 @menu
 point in the buffer.
 
 @menu
-* Global Break Condition::     Breaking on an event. 
+* Global Break Condition::     Breaking on an event.
 * Source Breakpoints::         Embedding breakpoints in source code.
 @end menu
 
 * Source Breakpoints::         Embedding breakpoints in source code.
 @end menu
 
@@ -692,7 +697,7 @@ but they are evaluated in the context outside of Edebug.
 
   The expressions you enter interactively (and their results) are lost
 when you continue execution; but you can set up an @dfn{evaluation list}
 
   The expressions you enter interactively (and their results) are lost
 when you continue execution; but you can set up an @dfn{evaluation list}
-consisting of expressions to be evaluated each time execution stops. 
+consisting of expressions to be evaluated each time execution stops.
 
 @cindex evaluation list group
   To do this, write one or more @dfn{evaluation list groups} in the
 
 @cindex evaluation list group
   To do this, write one or more @dfn{evaluation list groups} in the
@@ -771,7 +776,7 @@ If non-@code{nil}, Edebug binds @code{print-length} to this value while
 printing results.  The default value is @code{50}.
 @end defopt
 
 printing results.  The default value is @code{50}.
 @end defopt
 
-@defopt edebug-print-level 
+@defopt edebug-print-level
 If non-@code{nil}, Edebug binds @code{print-level} to this value while
 printing results.  The default value is @code{50}.
 @end defopt
 If non-@code{nil}, Edebug binds @code{print-level} to this value while
 printing results.  The default value is @code{50}.
 @end defopt
@@ -794,7 +799,7 @@ Custom printing prints this as @samp{Result: #1=(#1# y)}.  The
 structure.  This notation is used for any shared elements of lists or
 vectors.
 
 structure.  This notation is used for any shared elements of lists or
 vectors.
 
-@defopt edebug-print-circle 
+@defopt edebug-print-circle
 If non-@code{nil}, Edebug binds @code{print-circle} to this value while
 printing results.  The default value is @code{nil}.
 @end defopt
 If non-@code{nil}, Edebug binds @code{print-circle} to this value while
 printing results.  The default value is @code{nil}.
 @end defopt
@@ -871,8 +876,12 @@ performed for all execution of an instrumented function, even if the
 execution mode is Go-nonstop, and regardless of whether coverage testing
 is enabled.
 
 execution mode is Go-nonstop, and regardless of whether coverage testing
 is enabled.
 
-  Use @kbd{M-x edebug-display-freq-count} to display both the
-coverage information and the frequency counts for a definition.
+@kindex C-x X =
+@findex edebug-temp-display-freq-count
+  Use @kbd{C-x X =} (@code{edebug-display-freq-count}) to display both
+the coverage information and the frequency counts for a definition.
+Just @kbd{=} (@code{edebug-temp-display-freq-count}) displays the same
+information temporarily, only until you type another key.
 
 @deffn Command edebug-display-freq-count
 This command displays the frequency count data for each line of the
 
 @deffn Command edebug-display-freq-count
 This command displays the frequency count data for each line of the
@@ -900,13 +909,13 @@ the breakpoint is reached, the frequency data looks like this:
 @example
 (defun fac (n)
   (if (= n 0) (edebug))
 @example
 (defun fac (n)
   (if (= n 0) (edebug))
-;#6           1      0 =5 
+;#6           1      0 =5
   (if (< 0 n)
   (if (< 0 n)
-;#5         = 
+;#5         =
       (* n (fac (1- n)))
       (* n (fac (1- n)))
-;#    5               0  
+;#    5               0
     1))
     1))
-;#   0 
+;#   0
 @end example
 
 The comment lines show that @code{fac} was called 6 times.  The
 @end example
 
 The comment lines show that @code{fac} was called 6 times.  The
@@ -939,12 +948,12 @@ before even deciding whether to make trace information or stop the
 program.
 
 @itemize @bullet
 program.
 
 @itemize @bullet
-@item 
+@item
 @code{max-lisp-eval-depth} and @code{max-specpdl-size} are both
 incremented once to reduce Edebug's impact on the stack.  You could,
 however, still run out of stack space when using Edebug.
 
 @code{max-lisp-eval-depth} and @code{max-specpdl-size} are both
 incremented once to reduce Edebug's impact on the stack.  You could,
 however, still run out of stack space when using Edebug.
 
-@item 
+@item
 The state of keyboard macro execution is saved and restored.  While
 Edebug is active, @code{executing-macro} is bound to
 @code{edebug-continue-kbd-macro}.
 The state of keyboard macro execution is saved and restored.  While
 Edebug is active, @code{executing-macro} is bound to
 @code{edebug-continue-kbd-macro}.
@@ -958,7 +967,7 @@ Edebug is active, @code{executing-macro} is bound to
 @c This paragraph is not filled, because LaLiberte's conversion script
 @c needs an xref to be on just one line.
 When Edebug needs to display something (e.g., in trace mode), it saves
 @c This paragraph is not filled, because LaLiberte's conversion script
 @c needs an xref to be on just one line.
 When Edebug needs to display something (e.g., in trace mode), it saves
-the current window configuration from ``outside'' Edebug 
+the current window configuration from ``outside'' Edebug
 (@pxref{Window Configurations}).  When you exit Edebug (by continuing
 the program), it restores the previous window configuration.
 
 (@pxref{Window Configurations}).  When you exit Edebug (by continuing
 the program), it restores the previous window configuration.
 
@@ -974,12 +983,12 @@ following data (though some of them are deliberately not restored if an
 error or quit signal occurs).
 
 @itemize @bullet
 error or quit signal occurs).
 
 @itemize @bullet
-@item 
+@item
 @cindex current buffer point and mark (Edebug)
 Which buffer is current, and the positions of point and the mark in the
 current buffer, are saved and restored.
 
 @cindex current buffer point and mark (Edebug)
 Which buffer is current, and the positions of point and the mark in the
 current buffer, are saved and restored.
 
-@item 
+@item
 @cindex window configuration (Edebug)
 The outside window configuration is saved and restored if
 @code{edebug-save-windows} is non-@code{nil} (@pxref{Edebug Display Update}).
 @cindex window configuration (Edebug)
 The outside window configuration is saved and restored if
 @code{edebug-save-windows} is non-@code{nil} (@pxref{Edebug Display Update}).
@@ -1002,7 +1011,7 @@ The variables @code{overlay-arrow-position} and
 @code{overlay-arrow-string} are saved and restored.  So you can safely
 invoke Edebug from the recursive edit elsewhere in the same buffer.
 
 @code{overlay-arrow-string} are saved and restored.  So you can safely
 invoke Edebug from the recursive edit elsewhere in the same buffer.
 
-@item 
+@item
 @code{cursor-in-echo-area} is locally bound to @code{nil} so that
 the cursor shows up in the window.
 @end itemize
 @code{cursor-in-echo-area} is locally bound to @code{nil} so that
 the cursor shows up in the window.
 @end itemize
@@ -1047,7 +1056,7 @@ evaluation list window.
 by the @code{recursive-edit}, but Edebug temporarily restores them during
 evaluations.
 
 by the @code{recursive-edit}, but Edebug temporarily restores them during
 evaluations.
 
-@item 
+@item
 The state of keyboard macro definition is saved and restored.  While
 Edebug is active, @code{defining-kbd-macro} is bound to
 @code{edebug-continue-kbd-macro}.
 The state of keyboard macro definition is saved and restored.  While
 Edebug is active, @code{defining-kbd-macro} is bound to
 @code{edebug-continue-kbd-macro}.
@@ -1063,32 +1072,43 @@ macro call are forms to be evaluated.  (Evaluation may occur explicitly
 in the macro body, or when the resulting expansion is evaluated, or any
 time later.)
 
 in the macro body, or when the resulting expansion is evaluated, or any
 time later.)
 
-  Therefore, you must define an Edebug specification for each macro that
-Edebug will encounter, to explain the format of calls to that macro.  To
-do this, use @code{def-edebug-spec}.
+  Therefore, you must define an Edebug specification for each macro
+that Edebug will encounter, to explain the format of calls to that
+macro.  To do this, add an @code{edebug} declaration to the macro
+definition.  Here is a simple example that shows the specification for
+the @code{for} example macro (@pxref{Argument Evaluation}).
+
+@example
+(defmacro for (var from init to final do &rest body)
+  "Execute a simple \"for\" loop.
+For example, (for i from 1 to 10 do (print i))."
+  (declare (edebug symbolp "from" form "to" form "do" &rest form))
+  ...)
+@end example
+
+  The Edebug specification says which parts of a call to the macro are
+forms to be evaluated.  For simple macros, the @var{specification}
+often looks very similar to the formal argument list of the macro
+definition, but specifications are much more general than macro
+arguments.  @xref{Defining Macros}, for more explanation of
+the @code{declare} form.
+
+  You can also define an edebug specification for a macro separately
+from the macro definition with @code{def-edebug-spec}.  Adding
+@code{edebug} declarations is preferred, and more convenient, for
+macro definitions in Lisp, but @code{def-edebug-spec} makes it
+possible to define Edebug specifications for special forms implemented
+in C.
 
 @deffn Macro def-edebug-spec macro specification
 Specify which expressions of a call to macro @var{macro} are forms to be
 
 @deffn Macro def-edebug-spec macro specification
 Specify which expressions of a call to macro @var{macro} are forms to be
-evaluated.  For simple macros, the @var{specification} often looks very
-similar to the formal argument list of the macro definition, but
-specifications are much more general than macro arguments.
+evaluated.  @var{specification} should be the edebug specification.
+It is not evaluated.
 
 The @var{macro} argument can actually be any symbol, not just a macro
 name.
 @end deffn
 
 
 The @var{macro} argument can actually be any symbol, not just a macro
 name.
 @end deffn
 
-Here is a simple example that defines the specification for the
-@code{for} example macro (@pxref{Argument Evaluation}), followed by an
-alternative, equivalent specification.
-
-@example
-(def-edebug-spec for
-  (symbolp "from" form "to" form "do" &rest form))
-
-(def-edebug-spec for
-  (symbolp ['from form] ['to form] ['do body]))
-@end example
-
 Here is a table of the possibilities for @var{specification} and how each
 directs processing of arguments.
 
 Here is a table of the possibilities for @var{specification} and how each
 directs processing of arguments.
 
@@ -1173,9 +1193,9 @@ either way.
 A lambda expression with no quoting.
 
 @item &optional
 A lambda expression with no quoting.
 
 @item &optional
-@kindex &optional @r{(Edebug)}
+@c @kindex &optional @r{(Edebug)}
 All following elements in the specification list are optional; as soon
 All following elements in the specification list are optional; as soon
-as one does not match, Edebug stops matching at this level.  
+as one does not match, Edebug stops matching at this level.
 
 To make just a few elements optional followed by non-optional elements,
 use @code{[&optional @var{specs}@dots{}]}.  To specify that several
 
 To make just a few elements optional followed by non-optional elements,
 use @code{[&optional @var{specs}@dots{}]}.  To specify that several
@@ -1183,7 +1203,7 @@ elements must all match or none, use @code{&optional
 [@var{specs}@dots{}]}.  See the @code{defun} example below.
 
 @item &rest
 [@var{specs}@dots{}]}.  See the @code{defun} example below.
 
 @item &rest
-@kindex &rest @r{(Edebug)}
+@c @kindex &rest @r{(Edebug)}
 All following elements in the specification list are repeated zero or
 more times.  In the last repetition, however, it is not a problem if the
 expression runs out before matching all of the elements of the
 All following elements in the specification list are repeated zero or
 more times.  In the last repetition, however, it is not a problem if the
 expression runs out before matching all of the elements of the
@@ -1194,7 +1214,7 @@ To specify several elements that must all match on every repetition, use
 @code{&rest [@var{specs}@dots{}]}.
 
 @item &or
 @code{&rest [@var{specs}@dots{}]}.
 
 @item &or
-@kindex &or @r{(Edebug)}
+@c @kindex &or @r{(Edebug)}
 Each of the following elements in the specification list is an
 alternative.  One of the alternatives must match, or the @code{&or}
 specification fails.
 Each of the following elements in the specification list is an
 alternative.  One of the alternatives must match, or the @code{&or}
 specification fails.
@@ -1204,14 +1224,14 @@ group two or more list elements as a single alternative, enclose them in
 @code{[@dots{}]}.
 
 @item &not
 @code{[@dots{}]}.
 
 @item &not
-@kindex &not @r{(Edebug)}
+@c @kindex &not @r{(Edebug)}
 Each of the following elements is matched as alternatives as if by using
 @code{&or}, but if any of them match, the specification fails.  If none
 of them match, nothing is matched, but the @code{&not} specification
 succeeds.
 
 Each of the following elements is matched as alternatives as if by using
 @code{&or}, but if any of them match, the specification fails.  If none
 of them match, nothing is matched, but the @code{&not} specification
 succeeds.
 
-@item &define 
-@kindex &define @r{(Edebug)}
+@item &define
+@c @kindex &define @r{(Edebug)}
 Indicates that the specification is for a defining form.  The defining
 form itself is not instrumented (that is, Edebug does not stop before and
 after the defining form), but forms inside it typically will be
 Indicates that the specification is for a defining form.  The defining
 form itself is not instrumented (that is, Edebug does not stop before and
 after the defining form), but forms inside it typically will be
@@ -1290,7 +1310,7 @@ Here is a list of additional specifications that may appear only after
 
 @table @code
 @item name
 
 @table @code
 @item name
-The argument, a symbol, is the name of the defining form. 
+The argument, a symbol, is the name of the defining form.
 
 A defining form is not required to have a name field; and it may have
 multiple name fields.
 
 A defining form is not required to have a name field; and it may have
 multiple name fields.
@@ -1337,7 +1357,7 @@ necessarily mean a syntax error will be signaled; instead,
 exhausted.  Eventually every element of the argument list must be
 matched by some element in the specification, and every required element
 in the specification must match some argument.
 exhausted.  Eventually every element of the argument list must be
 matched by some element in the specification, and every required element
 in the specification must match some argument.
-  
+
 When a syntax error is detected, it might not be reported until much
 later after higher-level alternatives have been exhausted, and with the
 point positioned further from the real error.  But if backtracking is
 When a syntax error is detected, it might not be reported until much
 later after higher-level alternatives have been exhausted, and with the
 point positioned further from the real error.  But if backtracking is
@@ -1361,7 +1381,7 @@ all begin with the same symbol, you can usually work around this
 constraint by factoring the symbol out of the alternatives, e.g.,
 @code{["foo" &or [first case] [second case] ...]}.
 
 constraint by factoring the symbol out of the alternatives, e.g.,
 @code{["foo" &or [first case] [second case] ...]}.
 
-Most needs are satisfied by these two ways that bactracking is
+Most needs are satisfied by these two ways that backtracking is
 automatically disabled, but occasionally it is useful to explicitly
 disable backtracking by using the @code{gate} specification.  This is
 useful when you know that no higher alternatives could apply.  See the
 automatically disabled, but occasionally it is useful to explicitly
 disable backtracking by using the @code{gate} specification.  This is
 useful when you know that no higher alternatives could apply.  See the
@@ -1393,8 +1413,8 @@ function body.
 
 @smallexample
 (def-edebug-spec defmacro defun) ; @r{Indirect ref to @code{defun} spec.}
 
 @smallexample
 (def-edebug-spec defmacro defun) ; @r{Indirect ref to @code{defun} spec.}
-(def-edebug-spec defun 
-  (&define name lambda-list 
+(def-edebug-spec defun
+  (&define name lambda-list
            [&optional stringp]   ; @r{Match the doc string, if present.}
            [&optional ("interactive" interactive)]
            def-body))
            [&optional stringp]   ; @r{Match the doc string, if present.}
            [&optional ("interactive" interactive)]
            def-body))
@@ -1467,7 +1487,7 @@ what happens to the window configurations, it is better to set this
 variable to @code{nil}.
 
 If the value is a list, only the listed windows are saved and
 variable to @code{nil}.
 
 If the value is a list, only the listed windows are saved and
-restored.  
+restored.
 
 You can use the @kbd{W} command in Edebug to change this variable
 interactively.  @xref{Edebug Display Update}.
 
 You can use the @kbd{W} command in Edebug to change this variable
 interactively.  @xref{Edebug Display Update}.
@@ -1493,26 +1513,26 @@ mode for Edebug when it is first activated.  Possible values are
 @code{step}, @code{next}, @code{go}, @code{Go-nonstop}, @code{trace},
 @code{Trace-fast}, @code{continue}, and @code{Continue-fast}.
 
 @code{step}, @code{next}, @code{go}, @code{Go-nonstop}, @code{trace},
 @code{Trace-fast}, @code{continue}, and @code{Continue-fast}.
 
-The default value is @code{step}.  
+The default value is @code{step}.
 @xref{Edebug Execution Modes}.
 @end defopt
 
 @defopt edebug-trace
 Non-@code{nil} means display a trace of function entry and exit.
 Tracing output is displayed in a buffer named @samp{*edebug-trace*}, one
 @xref{Edebug Execution Modes}.
 @end defopt
 
 @defopt edebug-trace
 Non-@code{nil} means display a trace of function entry and exit.
 Tracing output is displayed in a buffer named @samp{*edebug-trace*}, one
-function entry or exit per line, indented by the recursion level.  
+function entry or exit per line, indented by the recursion level.
 
 
-The default value is @code{nil}.  
+The default value is @code{nil}.
 
 Also see @code{edebug-tracing}, in @ref{Trace Buffer}.
 @end defopt
 
 
 Also see @code{edebug-tracing}, in @ref{Trace Buffer}.
 @end defopt
 
-@defopt edebug-test-coverage 
+@defopt edebug-test-coverage
 If non-@code{nil}, Edebug tests coverage of all expressions debugged.
 @xref{Coverage Testing}.
 @end defopt
 
 If non-@code{nil}, Edebug tests coverage of all expressions debugged.
 @xref{Coverage Testing}.
 @end defopt
 
-@defopt edebug-continue-kbd-macro 
+@defopt edebug-continue-kbd-macro
 If non-@code{nil}, continue defining or executing any keyboard macro
 that is executing outside of Edebug.   Use this with caution since it is not
 debugged.
 If non-@code{nil}, continue defining or executing any keyboard macro
 that is executing outside of Edebug.   Use this with caution since it is not
 debugged.
@@ -1538,7 +1558,11 @@ until the @emph{next} time Edebug is invoked via a new command.
 @c A new command is not precisely true, but that is close enough -- dan
 
 @defopt edebug-global-break-condition
 @c A new command is not precisely true, but that is close enough -- dan
 
 @defopt edebug-global-break-condition
-If non-@code{nil}, an expression to test for at every stop point.
-If the result is non-nil, then break.  Errors are ignored.
+If non-@code{nil}, an expression to test for at every stop point.  If
+the result is non-@code{nil}, then break.  Errors are ignored.
 @xref{Global Break Condition}.
 @end defopt
 @xref{Global Break Condition}.
 @end defopt
+
+@ignore
+   arch-tag: 74842db8-019f-4818-b5a4-b2de878e57fd
+@end ignore