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 a 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
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.
This variable determines whether the debugger is called when
quitis signaled and not handled. If
nil, then the debugger is called whenever you quit (that is, type C-g). If
nil, then the debugger is not called when you quit. See Quitting.