blob: cb7134906cc688436f0bddc6d5675b2527881517 (
plain)
1
2
3
4
5
6
7
8
|
<h4 class="subsection">Debugging Infinite Loops</h4> <p>When a program loops infinitely and fails to return, your first problem is to stop the loop. On most operating systems, you can do this with <kbd>C-g</kbd>, which causes a <em>quit</em>. See <a href="quitting">Quitting</a>. </p> <p>Ordinary quitting gives no information about why the program was looping. To get more information, you can set the variable <code>debug-on-quit</code> to non-<code>nil</code>. Once you have the debugger running in the middle of the infinite loop, you can proceed from the debugger using the stepping commands. If you step through the entire loop, you may get enough information to solve the problem. </p> <p>Quitting with <kbd>C-g</kbd> is not considered an error, and <code>debug-on-error</code> has no effect on the handling of <kbd>C-g</kbd>. Likewise, <code>debug-on-quit</code> has no effect on errors. </p> <dl> <dt id="debug-on-quit">User Option: <strong>debug-on-quit</strong>
</dt> <dd><p>This variable determines whether the debugger is called when <code>quit</code> is signaled and not handled. If <code>debug-on-quit</code> is non-<code>nil</code>, then the debugger is called whenever you quit (that is, type <kbd>C-g</kbd>). If <code>debug-on-quit</code> is <code>nil</code> (the default), then the debugger is not called when you quit. </p></dd>
</dl><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/Infinite-Loops.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Infinite-Loops.html</a>
</p>
</div>
|