diff options
Diffstat (limited to 'doc/lispref/debugging.texi')
| -rw-r--r-- | doc/lispref/debugging.texi | 44 |
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 |
| 106 | this.) | 107 | this.) |
| 107 | 108 | ||
| 109 | Note that, for technical reasons, you cannot use the facilities | ||
| 110 | defined in this subsection to debug errors in Lisp that the redisplay | ||
| 111 | code has invoked. @xref{Debugging Redisplay}, for help with these. | ||
| 112 | |||
| 108 | @defopt debug-on-error | 113 | @defopt debug-on-error |
| 109 | This variable determines whether the debugger is called when an error | 114 | This variable determines whether the debugger is called when an error |
| 110 | is signaled and not handled. If @code{debug-on-error} is @code{t}, | 115 | is 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 | |||
| 213 | bypasses the @code{condition-case} which normally catches errors in the | 218 | bypasses the @code{condition-case} which normally catches errors in the |
| 214 | init file. | 219 | init file. |
| 215 | 220 | ||
| 221 | @node Debugging Redisplay | ||
| 222 | @subsection Debugging Redisplay Errors | ||
| 223 | @cindex redisplay errors | ||
| 224 | @cindex debugging redisplay errors | ||
| 225 | |||
| 226 | When an error occurs in Lisp code which redisplay has invoked, Emacs's | ||
| 227 | usual debugging mechanisms are unusable, for technical reasons. This | ||
| 228 | subsection describes how to get a backtrace from such an error, which | ||
| 229 | should be helpful in debugging it. | ||
| 230 | |||
| 231 | These directions apply to Lisp forms used, for example, in | ||
| 232 | @code{:eval} mode line constructs (@pxref{Mode Line Data}), and in all | ||
| 233 | hooks 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 | |||
| 242 | Note that if you have had an error in a hook function called from | ||
| 243 | redisplay, the error handling might have removed this function from | ||
| 244 | the hook. You will thus need to reinitialize that hook somehow, | ||
| 245 | perhaps with @code{add-hook}, to be able to replay the bug. | ||
| 246 | |||
| 247 | To generate a backtrace in these circumstances, set the variable | ||
| 248 | @code{backtrace-on-redisplay-error} to non-@code{nil}. When the error | ||
| 249 | occurs, Emacs will dump the backtrace to the buffer | ||
| 250 | @file{*Redisplay-trace*}, but won't automatically display it in a | ||
| 251 | window. This is to avoid needlessly corrupting the redisplay you are | ||
| 252 | debugging. You will thus need to display the buffer yourself, with a | ||
| 253 | command such as @code{switch-to-buffer-other-frame} @key{C-x 5 b}. | ||
| 254 | |||
| 255 | @defvar backtrace-on-redisplay-error | ||
| 256 | Set this variable to non-@code{nil} to enable the generation of a | ||
| 257 | backtrace 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 |