Go to the first, previous, next, last section, table of contents.


Debugging Infinite Loops

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 C-g, which causes quit.

Ordinary quitting gives no information about why the program was looping. To get more information, you can set the variable debug-on-quit to non-nil. Quitting with C-g is not considered an error, and debug-on-error has no effect on the handling of C-g. Likewise, debug-on-quit has no effect on errors.

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 will probably get enough information to solve the problem.

User Option: debug-on-quit
This variable determines whether the debugger is called when quit is signaled and not handled. If debug-on-quit is non-nil, then the debugger is called whenever you quit (that is, type C-g). If debug-on-quit is nil, then the debugger is not called when you quit. See section Quitting.


Go to the first, previous, next, last section, table of contents.