aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref/debugging.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref/debugging.texi')
-rw-r--r--doc/lispref/debugging.texi44
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 058c9319544..9ae40949d1e 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -77,6 +77,7 @@ debugger recursively. @xref{Recursive Editing}.
77 77
78@menu 78@menu
79* Error Debugging:: Entering the debugger when an error happens. 79* Error Debugging:: Entering the debugger when an error happens.
80* Debugging Redisplay:: Getting backtraces from redisplay errors.
80* Infinite Loops:: Stopping and debugging a program that doesn't exit. 81* Infinite Loops:: Stopping and debugging a program that doesn't exit.
81* Function Debugging:: Entering it when a certain function is called. 82* Function Debugging:: Entering it when a certain function is called.
82* Variable Debugging:: Entering it when a variable is modified. 83* Variable Debugging:: Entering it when a variable is modified.
@@ -105,6 +106,10 @@ debugger, set the variable @code{debug-on-error} to non-@code{nil}.
105(The command @code{toggle-debug-on-error} provides an easy way to do 106(The command @code{toggle-debug-on-error} provides an easy way to do
106this.) 107this.)
107 108
109Note that, for technical reasons, you cannot use the facilities
110defined in this subsection to debug errors in Lisp that the redisplay
111code has invoked. @xref{Debugging Redisplay}, for help with these.
112
108@defopt debug-on-error 113@defopt debug-on-error
109This variable determines whether the debugger is called when an error 114This variable determines whether the debugger is called when an error
110is signaled and not handled. If @code{debug-on-error} is @code{t}, 115is signaled and not handled. If @code{debug-on-error} is @code{t},
@@ -213,6 +218,45 @@ file, use the option @samp{--debug-init}. This binds
213bypasses the @code{condition-case} which normally catches errors in the 218bypasses the @code{condition-case} which normally catches errors in the
214init file. 219init file.
215 220
221@node Debugging Redisplay
222@subsection Debugging Redisplay Errors
223@cindex redisplay errors
224@cindex debugging redisplay errors
225
226When an error occurs in Lisp code which redisplay has invoked, Emacs's
227usual debugging mechanisms are unusable, for technical reasons. This
228subsection describes how to get a backtrace from such an error, which
229should be helpful in debugging it.
230
231These directions apply to Lisp forms used, for example, in
232@code{:eval} mode line constructs (@pxref{Mode Line Data}), and in all
233hooks invoked from redisplay, such as:
234
235@itemize
236@item
237@code{fontification-functions} (@pxref{Auto Faces}).
238@item
239@code{window-scroll-functions} (@pxref{Window Hooks}).
240@end itemize
241
242Note that if you have had an error in a hook function called from
243redisplay, the error handling might have removed this function from
244the hook. You will thus need to reinitialize that hook somehow,
245perhaps with @code{add-hook}, to be able to replay the bug.
246
247To generate a backtrace in these circumstances, set the variable
248@code{backtrace-on-redisplay-error} to non-@code{nil}. When the error
249occurs, Emacs will dump the backtrace to the buffer
250@file{*Redisplay-trace*}, but won't automatically display it in a
251window. This is to avoid needlessly corrupting the redisplay you are
252debugging. You will thus need to display the buffer yourself, with a
253command such as @code{switch-to-buffer-other-frame} @key{C-x 5 b}.
254
255@defvar backtrace-on-redisplay-error
256Set this variable to non-@code{nil} to enable the generation of a
257backtrace when an error occurs in any Lisp called from redisplay.
258@end defvar
259
216@node Infinite Loops 260@node Infinite Loops
217@subsection Debugging Infinite Loops 261@subsection Debugging Infinite Loops
218@cindex infinite loops 262@cindex infinite loops