Edebug’s step mode stops execution when the next stop point is reached. There are three other ways to stop Edebug execution once it has started: breakpoints, the global break condition, and source breakpoints.
|• Breakpoints||Breakpoints at stop points.|
|• Global Break Condition||Breaking on an event.|
|• Source Breakpoints||Embedding breakpoints in source code.|
188.8.131.52 Edebug Breakpoints
While using Edebug, you can specify breakpoints in the program you are testing: these are places where execution should stop. You can set a breakpoint at any stop point, as defined in Using Edebug. For setting and unsetting breakpoints, the stop point that is affected is the first one at or after point in the source code buffer. Here are the Edebug commands for breakpoints:
Set a breakpoint at the stop point at or after point (
edebug-set-breakpoint). If you use a prefix argument, the breakpoint is temporary—it turns off the first time it stops the program. An overlay with the
edebug-disabled-breakpoint faces is put at the breakpoint.
Unset the breakpoint (if any) at the stop point at or after point (
Unset any breakpoints in the current form (
Toggle whether to disable the breakpoint near point (
edebug-toggle-disable-breakpoint). This command is mostly useful if the breakpoint is conditional and it would take some work to recreate the condition.
x condition RET
Set a conditional breakpoint which stops the program only if evaluating
condition produces a non-
nil value (
edebug-set-conditional-breakpoint). With a prefix argument, the breakpoint is temporary.
Move point to the next breakpoint in the current definition (
While in Edebug, you can set a breakpoint with
b and unset one with
u. First move point to the Edebug stop point of your choice, then type
u to set or unset a breakpoint there. Unsetting a breakpoint where none has been set has no effect.
Re-evaluating or reinstrumenting a definition removes all of its previous breakpoints.
A conditional breakpoint tests a condition each time the program gets there. Any errors that occur as a result of evaluating the condition are ignored, as if the result were
nil. To set a conditional breakpoint, use
x, and specify the condition expression in the minibuffer. Setting a conditional breakpoint at a stop point that has a previously established conditional breakpoint puts the previous condition expression in the minibuffer so you can edit it.
You can make a conditional or unconditional breakpoint temporary by using a prefix argument with the command to set the breakpoint. When a temporary breakpoint stops the program, it is automatically unset.
Edebug always stops or pauses at a breakpoint, except when the Edebug mode is Go-nonstop. In that mode, it ignores breakpoints entirely.
To find out where your breakpoints are, use the
B command, which moves point to the next breakpoint following point, within the same function, or to the first breakpoint if there are no following breakpoints. This command does not continue execution—it just moves point in the buffer.
184.108.40.206 Global Break Condition
A global break condition stops execution when a specified condition is satisfied, no matter where that may occur. Edebug evaluates the global break condition at every stop point; if it evaluates to a non-
nil value, then execution stops or pauses depending on the execution mode, as if a breakpoint had been hit. If evaluating the condition gets an error, execution does not stop.
The condition expression is stored in
edebug-global-break-condition. You can specify a new expression using the
X command from the source code buffer while Edebug is active, or using
C-x X X from any buffer at any time, as long as Edebug is loaded (
The global break condition is the simplest way to find where in your code some event occurs, but it makes code run much more slowly. So you should reset the condition to
nil when not using it.
220.127.116.11 Source Breakpoints
All breakpoints in a definition are forgotten each time you reinstrument it. If you wish to make a breakpoint that won’t be forgotten, you can write a source breakpoint, which is simply a call to the function
edebug in your source code. You can, of course, make such a call conditional. For example, in the
fac function, you can insert the first line as shown below, to stop when the argument reaches zero:
(defun fac (n)
(if (= n 0) (edebug))
(if (< 0 n)
(* n (fac (1- n)))
fac definition is instrumented and the function is called, the call to
edebug acts as a breakpoint. Depending on the execution mode, Edebug stops or pauses there.
If no instrumented code is being executed when
edebug is called, that function calls