Next: Debug Messages, Previous: Debugger Mode, Up: Debugging [Index]
Edebug
is a source level debugger for EmacsLisp. It instruments code. This
means that Emacs adds special instructions to the code when it is evaluated, to
invoke Edebug at the proper places.
is the main entry point to Edebug. Use it instead of ‘C-x C-e’ or ‘C-M-x’
to evaluate a ‘defun’ and instrument it for debugging. When you invoke
command ‘C-u C-M-x’ (eval-defun
with a prefix argument) on a function
definition, it instruments the definition before evaluating it.
See the variables:
edebug-all-defs
and
edebug-all-forms
to control how ~eval-defun~ operates.
See also the commands:
eval-region
eval-current-buffer
eval-buffer
edebug-eval-top-level-form
edebug-defun
(an alias of edebug-eval-top-level-form
edebug-defun
must be able to read your code. It expects all function
definitions to start in column 0. If they do not, hitting ‘C-u C-M-x’ will
show you the wrong function name in the echo area.
Once a function is instrumented, any call to the function activates Edebug. The action that occurs depends on which execution mode is active. The default execution mode is ‘step’, which stops execution. You will be viewing a read-only buffer of the source code that is being debugged (the source code buffer). An arrow in the left fringe indicates the line where the function is executing. The special commands of Edebug are available in the source code buffer in addition to the commands of Emacs Lisp mode.
The places within a function where Edebug can stop execution are called “stop points”. These occur both before and after each subexpression that is a list, and also after each variable reference. When Edebug stops execution after an expression, it displays the expression’s value in the echo area.
execute until the next stop point
set a breakpoint at a stop point
execute until a breakpoint is reached
exit Edebug
display a l ist of all Edebug commands
While executing or tracing, you can interrupt the execution by typing any Edebug command. Edebug stops the program at the next stop point and then executes the command you typed. For example, typing ‘t’ during execution switches to trace mode at the next stop point. You can use ‘S’ to stop execution without doing anything else.
Next: Debug Messages, Previous: Debugger Mode, Up: Debugging [Index]