blob: 505342f623266d6134e070bbe0e53048dfddf0cd (
plain)
1
2
3
4
5
6
|
<h4 class="subsection">Explicit Entry to the Debugger</h4> <p>You can cause the debugger to be called at a certain point in your program by writing the expression <code>(debug)</code> at that point. To do this, visit the source file, insert the text ‘<samp>(debug)</samp>’ at the proper place, and type <kbd>C-M-x</kbd> (<code>eval-defun</code>, a Lisp mode key binding). <strong>Warning:</strong> if you do this for temporary debugging purposes, be sure to undo this insertion before you save the file! </p> <p>The place where you insert ‘<samp>(debug)</samp>’ must be a place where an additional form can be evaluated and its value ignored. (If the value of <code>(debug)</code> isn’t ignored, it will alter the execution of the program!) The most common suitable places are inside a <code>progn</code> or an implicit <code>progn</code> (see <a href="sequencing">Sequencing</a>). </p> <p>If you don’t know exactly where in the source code you want to put the debug statement, but you want to display a backtrace when a certain message is displayed, you can set <code>debug-on-message</code> to a regular expression matching the desired message. </p><div class="_attribution">
<p class="_attribution-p">
Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Explicit-Debug.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Explicit-Debug.html</a>
</p>
</div>
|