Home / Notes /

Debug in Emacs

Table of Contents

This is a note on debugging in Emacs.

1 debug

enter the debugger when a function is called
As the name suggests
whether to enter the debugger if an error occurs

When you are in the debugger, you have following commands for use:

c continue, but don’t stop next time.
d continue and enter the debugger again next time.
e evaluate expressions (better than M-:).
r return a value from debugger.
l list functions that will enter the debugger.
b flag the current frame so we will enter debugger again when the frame exits.

Complete list of commands

2 edebug

edebug-defun / C-u eval-defun
instrument function to enter stepper when the function runs. To cancel the instrument, simply use eval-defun to reevaluate the function normally.

Some common commands in edebug:

n step
q quit
r re-display last value in echo area
b set break point, use C-u to set a one-time break point
x set break condition
c continue

Complete list of commands

Written by Yuan Fu

First Published in 2019-10-05 Sat 14:31

Last modified in 2020-08-20 Thu 13:12

Send your comment to [email protected]