Edebug

Edebug is an elaborate debugging environment that is far more powerful than the debugging facilities described in the previous section. It allows you to step through the actual source code of a running Lisp program. Edebug is an amazing piece of work written entirely in Lisp; it's a testament both to the talents of its author, Daniel LaLiberte, and to the expressive power of Emacs Lisp, which provides enough access to its own internals to make such a tool possible.

This section is only a brief summary of Edebug. For complete information, refer to the Edebug section of The GNU Emacs Lisp Reference Manual. Details on obtaining it are in Appendix E.

To use Edebug, you must select those functions that you specifically wish to be able to trace. Each function must be individually instrumented, which means evaluating it in a special way. The command edebug-defun performs this task, and is used like eval-defun. The variable edebug-all-defs (q.v.) controls whether loading Edebug should redefine the various eval- commands to do instrumenting as well.

After instrumenting the desired functions, leave their definitions available in some buffer. You can uninstrument functions by re-evaluating their definitions in the ordinary way.

Edebug is activated whenever any instrumented function is called. A window showing the function's definition appears, along with a little arrow in the left margin indicating on what line execution has stopped. The cursor will be placed at the beginning of the expression ...

Get Writing GNU Emacs Extensions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.