Next: Instrumenting for Edebug, Previous: Features of Edebug, Up: Edebug [Index]
Paste the following functions into the ‘*scratch*’ buffer (starting at column 0). Hit ‘C-M-x’ with the cursor inside each of the function definitions.
(defun foo () (interactive) (bar)) (defun bar () (let ((a 5) (b 7)) (message "%d" (+ a b))))
Use ‘M-x foo’. This prints ‘12’ in the echo area.
Now instrument ‘bar’ by moving the cursor into its code and hitting ‘C-u C-M-x’. The echo area shows ‘Edebug: bar’.
Use ‘M-x foo’ again. Emacs steps through the code of ‘bar’, showing you the result of evaluating each sexp in the echo area. Hit ‘SPC’ to step ahead or ‘e’ to evaluate another expression. The arrow shows you which sexp will be evaluated next:
(defun bar () =>(let ((a 5) (b 7)) (message "%d" (+ a b))))
To quit the debugger, type ‘q’.
Edebug can enter any defun whose source can be found with FindFunc by hitting ‘i’ which steps into the next function to be evaluated. This instruments the function and will be debugged every time it is run.
You can disable edebug on a function by evaluating the function again using ‘C-M-x’ without a PrefixArgument.
You can see the code coverage of the defun at point with C-x X =
or ‘M-x
edebug-display-freq-count’.