aboutsummaryrefslogtreecommitdiffstats
path: root/lispref/debugging.texi
diff options
context:
space:
mode:
authorKaroly Lorentey2005-03-06 13:31:20 +0000
committerKaroly Lorentey2005-03-06 13:31:20 +0000
commita0d878a9ccbfb7c68dd7cfbe05c2b71b9bd5c830 (patch)
tree79ba80d6f6c4b787c60b36ebcd87c1b26f0906e1 /lispref/debugging.texi
parentab455350da7728b0f8e1daf92c084092d8a04c29 (diff)
parentbe6e87e51aaa3a114bc4ff2ceccbc7c9aa2b30d0 (diff)
downloademacs-a0d878a9ccbfb7c68dd7cfbe05c2b71b9bd5c830.tar.gz
emacs-a0d878a9ccbfb7c68dd7cfbe05c2b71b9bd5c830.zip
Merged from miles@gnu.org--gnu-2005 (patch 34-36, 142-158)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-142 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-143 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-144 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-145 (make-text-button): Default button type if not specified * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-146 quick-install-emacs: Use mkdir --verbose only when requested * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-147 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-148 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-149 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-150 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-151 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-152 Add info/dir to arch branch * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-153 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-154 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-155 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-156 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-157 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-158 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-34 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-35 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-36 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-303
Diffstat (limited to 'lispref/debugging.texi')
-rw-r--r--lispref/debugging.texi120
1 files changed, 68 insertions, 52 deletions
diff --git a/lispref/debugging.texi b/lispref/debugging.texi
index e893b77ed84..07dfe18f283 100644
--- a/lispref/debugging.texi
+++ b/lispref/debugging.texi
@@ -1,6 +1,6 @@
1@c -*-texinfo-*- 1@c -*-texinfo-*-
2@c This is part of the GNU Emacs Lisp Reference Manual. 2@c This is part of the GNU Emacs Lisp Reference Manual.
3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998, 1999 3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998, 1999, 2005
4@c Free Software Foundation, Inc. 4@c Free Software Foundation, Inc.
5@c See the file elisp.texi for copying conditions. 5@c See the file elisp.texi for copying conditions.
6@setfilename ../info/debugging 6@setfilename ../info/debugging
@@ -14,7 +14,7 @@ depending on what you are doing with the program when the problem appears.
14@item 14@item
15If the problem occurs when you run the program, you can use a Lisp 15If the problem occurs when you run the program, you can use a Lisp
16debugger to investigate what is happening during execution. In addition 16debugger to investigate what is happening during execution. In addition
17to the ordinary debugger, Emacs comes with a source level debugger, 17to the ordinary debugger, Emacs comes with a source-level debugger,
18Edebug. This chapter describes both of them. 18Edebug. This chapter describes both of them.
19 19
20@item 20@item
@@ -117,6 +117,15 @@ the error. The easiest way is usually to set
117@code{debug-ignored-errors} to @code{nil}. 117@code{debug-ignored-errors} to @code{nil}.
118@end defopt 118@end defopt
119 119
120@defopt eval-expression-debug-on-error
121If you set this variable to a non-@code{nil} value, then
122@code{debug-on-error} will be set to @code{t} when evaluating with the
123command @code{eval-expression}. If
124@code{eval-expression-debug-on-error} is @code{nil}, then the value of
125@code{debug-on-error} is not changed. @xref{Lisp Eval,, Evaluating
126Emacs-Lisp Expressions, emacs, The GNU Emacs Manual}.
127@end defopt
128
120@defopt debug-on-signal 129@defopt debug-on-signal
121Normally, errors that are caught by @code{condition-case} never run the 130Normally, errors that are caught by @code{condition-case} never run the
122debugger, even if @code{debug-on-error} is non-@code{nil}. In other 131debugger, even if @code{debug-on-error} is non-@code{nil}. In other
@@ -240,14 +249,12 @@ Here's an example to illustrate use of this function:
240 249
241@group 250@group
242------ Buffer: *Backtrace* ------ 251------ Buffer: *Backtrace* ------
243Entering: 252Debugger entered--entering a function:
244* fact(3) 253* fact(3)
245 eval-region(4870 4878 t) 254 eval((fact 3))
246 byte-code("...") 255 eval-last-sexp-1(nil)
247 eval-last-sexp(nil) 256 eval-last-sexp(nil)
248 (let ...) 257 call-interactively(eval-last-sexp)
249 eval-insert-last-sexp(nil)
250* call-interactively(eval-insert-last-sexp)
251------ Buffer: *Backtrace* ------ 258------ Buffer: *Backtrace* ------
252@end group 259@end group
253 260
@@ -317,7 +324,9 @@ moving point to the line describing that frame. (A stack frame is the
317place where the Lisp interpreter records information about a particular 324place where the Lisp interpreter records information about a particular
318invocation of a function.) The frame whose line point is on is 325invocation of a function.) The frame whose line point is on is
319considered the @dfn{current frame}. Some of the debugger commands 326considered the @dfn{current frame}. Some of the debugger commands
320operate on the current frame. 327operate on the current frame. If a line starts with a star, that means
328that exiting that frame will call the debugger again. This is useful
329for examining the return value of a function.
321 330
322 If a function name is underlined, that means the debugger knows 331 If a function name is underlined, that means the debugger knows
323where its source code is located. You can click @kbd{Mouse-2} on that 332where its source code is located. You can click @kbd{Mouse-2} on that
@@ -328,8 +337,6 @@ assumptions about how many stack frames are used for the debugger
328itself. These assumptions are false if the debugger is running 337itself. These assumptions are false if the debugger is running
329interpreted. 338interpreted.
330 339
331@need 3000
332
333@node Debugger Commands 340@node Debugger Commands
334@subsection Debugger Commands 341@subsection Debugger Commands
335@cindex debugger command list 342@cindex debugger command list
@@ -378,6 +385,11 @@ Don't enter the debugger when the current frame is exited. This
378cancels a @kbd{b} command on that frame. The visible effect is to 385cancels a @kbd{b} command on that frame. The visible effect is to
379remove the star from the line in the backtrace buffer. 386remove the star from the line in the backtrace buffer.
380 387
388@item j
389Flag the current frame like @kbd{b}. Then continue execution like
390@kbd{c}, but temporarily disable break-on-entry for all functions that
391are set up to do so by @code{debug-on-entry}.
392
381@item e 393@item e
382Read a Lisp expression in the minibuffer, evaluate it, and print the 394Read a Lisp expression in the minibuffer, evaluate it, and print the
383value in the echo area. The debugger alters certain important 395value in the echo area. The debugger alters certain important
@@ -410,6 +422,13 @@ used as the value of that frame. It is also useful if you call
410effect as @kbd{c}, and the specified return value does not matter. 422effect as @kbd{c}, and the specified return value does not matter.
411 423
412You can't use @kbd{r} when the debugger was entered due to an error. 424You can't use @kbd{r} when the debugger was entered due to an error.
425
426@item l
427Display a list of functions that will invoke the debugger when called.
428This is a list of functions that are set to break on entry by means of
429@code{debug-on-entry}. @strong{Warning:} if you redefine such a
430function and thus cancel the effect of @code{debug-on-entry}, it may
431erroneously show up in this list.
413@end table 432@end table
414 433
415@node Invoking the Debugger 434@node Invoking the Debugger
@@ -425,10 +444,10 @@ recursive entry to the debugger, etc.), and fills it with information
425about the stack of Lisp function calls. It then enters a recursive 444about the stack of Lisp function calls. It then enters a recursive
426edit, showing the backtrace buffer in Debugger mode. 445edit, showing the backtrace buffer in Debugger mode.
427 446
428The Debugger mode @kbd{c} and @kbd{r} commands exit the recursive edit; 447The Debugger mode @kbd{c}, @kbd{d}, @kbd{j}, and @kbd{r} commands exit
429then @code{debug} switches back to the previous buffer and returns to 448the recursive edit; then @code{debug} switches back to the previous
430whatever called @code{debug}. This is the only way the function 449buffer and returns to whatever called @code{debug}. This is the only
431@code{debug} can return to its caller. 450way the function @code{debug} can return to its caller.
432 451
433The use of the @var{debugger-args} is that @code{debug} displays the 452The use of the @var{debugger-args} is that @code{debug} displays the
434rest of its arguments at the top of the @samp{*Backtrace*} buffer, so 453rest of its arguments at the top of the @samp{*Backtrace*} buffer, so
@@ -443,41 +462,41 @@ is a table of these special values:
443@table @code 462@table @code
444@item lambda 463@item lambda
445@cindex @code{lambda} in debug 464@cindex @code{lambda} in debug
446A first argument of @code{lambda} means @code{debug} was called because 465A first argument of @code{lambda} means @code{debug} was called
447of entry to a function when @code{debug-on-next-call} was 466because of entry to a function when @code{debug-on-next-call} was
448non-@code{nil}. The debugger displays @samp{Entering:} as a line of 467non-@code{nil}. The debugger displays @samp{Debugger
449text at the top of the buffer. 468entered--entering a function:} as a line of text at the top of the
469buffer.
450 470
451@item debug 471@item debug
452@code{debug} as first argument indicates a call to @code{debug} because 472@code{debug} as first argument indicates a call to @code{debug}
453of entry to a function that was set to debug on entry. The debugger 473because of entry to a function that was set to debug on entry. The
454displays @samp{Entering:}, just as in the @code{lambda} case. It also 474debugger displays @samp{Debugger entered--entering a function:}, just
455marks the stack frame for that function so that it will invoke the 475as in the @code{lambda} case. It also marks the stack frame for that
456debugger when exited. 476function so that it will invoke the debugger when exited.
457 477
458@item t 478@item t
459When the first argument is @code{t}, this indicates a call to 479When the first argument is @code{t}, this indicates a call to
460@code{debug} due to evaluation of a list form when 480@code{debug} due to evaluation of a list form when
461@code{debug-on-next-call} is non-@code{nil}. The debugger displays the 481@code{debug-on-next-call} is non-@code{nil}. The debugger displays
462following as the top line in the buffer: 482@samp{Debugger entered--beginning evaluation of function call form:}
463 483as the top line in the buffer.
464@smallexample
465Beginning evaluation of function call form:
466@end smallexample
467 484
468@item exit 485@item exit
469When the first argument is @code{exit}, it indicates the exit of a stack 486When the first argument is @code{exit}, it indicates the exit of a
470frame previously marked to invoke the debugger on exit. The second 487stack frame previously marked to invoke the debugger on exit. The
471argument given to @code{debug} in this case is the value being returned 488second argument given to @code{debug} in this case is the value being
472from the frame. The debugger displays @samp{Return value:} in the top 489returned from the frame. The debugger displays @samp{Debugger
473line of the buffer, followed by the value being returned. 490entered--returning value:} in the top line of the buffer, followed by
491the value being returned.
474 492
475@item error 493@item error
476@cindex @code{error} in debug 494@cindex @code{error} in debug
477When the first argument is @code{error}, the debugger indicates that 495When the first argument is @code{error}, the debugger indicates that
478it is being entered because an error or @code{quit} was signaled and not 496it is being entered because an error or @code{quit} was signaled and
479handled, by displaying @samp{Signaling:} followed by the error signaled 497not handled, by displaying @samp{Debugger entered--Lisp error:}
480and any arguments to @code{signal}. For example, 498followed by the error signaled and any arguments to @code{signal}.
499For example,
481 500
482@example 501@example
483@group 502@group
@@ -487,7 +506,7 @@ and any arguments to @code{signal}. For example,
487 506
488@group 507@group
489------ Buffer: *Backtrace* ------ 508------ Buffer: *Backtrace* ------
490Signaling: (arith-error) 509Debugger entered--Lisp error: (arith-error)
491 /(1 0) 510 /(1 0)
492... 511...
493------ Buffer: *Backtrace* ------ 512------ Buffer: *Backtrace* ------
@@ -522,7 +541,7 @@ some kind of debugger. The default value of the variable is
522 541
523The first argument that Lisp hands to the function indicates why it 542The first argument that Lisp hands to the function indicates why it
524was called. The convention for arguments is detailed in the description 543was called. The convention for arguments is detailed in the description
525of @code{debug}. 544of @code{debug} (@pxref{Invoking the Debugger}).
526@end defvar 545@end defvar
527 546
528@deffn Command backtrace 547@deffn Command backtrace
@@ -567,17 +586,14 @@ forms are elided.
567 (save-excursion ...) 586 (save-excursion ...)
568 (let ...) 587 (let ...)
569 (with-output-to-temp-buffer ...) 588 (with-output-to-temp-buffer ...)
570 eval-region(1973 2142 #<buffer *scratch*>) 589 eval((with-output-to-temp-buffer ...))
571 byte-code("... for eval-print-last-sexp ...") 590 eval-last-sexp-1(nil)
572@group 591@group
573 eval-print-last-sexp(nil) 592 eval-last-sexp(nil)
574* call-interactively(eval-print-last-sexp) 593 call-interactively(eval-last-sexp)
575----------- Buffer: backtrace-output ------------ 594----------- Buffer: backtrace-output ------------
576@end group 595@end group
577@end smallexample 596@end smallexample
578
579The character @samp{*} indicates a frame whose debug-on-exit flag is
580set.
581@end deffn 597@end deffn
582 598
583@ignore @c Not worth mentioning 599@ignore @c Not worth mentioning
@@ -687,8 +703,8 @@ find the mismatch.)
687 703
688 The first step is to find the defun that is unbalanced. If there is 704 The first step is to find the defun that is unbalanced. If there is
689an excess open parenthesis, the way to do this is to go to the end of 705an excess open parenthesis, the way to do this is to go to the end of
690the file and type @kbd{C-u C-M-u}. This will move you to the beginning 706the file and type @kbd{C-u C-M-u}. This will move you to the
691of the defun that is unbalanced. 707beginning of the first defun that is unbalanced.
692 708
693 The next step is to determine precisely what is wrong. There is no 709 The next step is to determine precisely what is wrong. There is no
694way to be sure of this except by studying the program, but often the 710way to be sure of this except by studying the program, but often the
@@ -719,9 +735,9 @@ anything.
719@node Excess Close 735@node Excess Close
720@subsection Excess Close Parentheses 736@subsection Excess Close Parentheses
721 737
722 To deal with an excess close parenthesis, first go to the beginning of 738 To deal with an excess close parenthesis, first go to the beginning
723the file, then type @kbd{C-u -1 C-M-u} to find the end of the unbalanced 739of the file, then type @kbd{C-u -1 C-M-u} to find the end of the first
724defun. 740unbalanced defun.
725 741
726 Then find the actual matching close parenthesis by typing @kbd{C-M-f} 742 Then find the actual matching close parenthesis by typing @kbd{C-M-f}
727at the beginning of that defun. This will leave you somewhere short of 743at the beginning of that defun. This will leave you somewhere short of