aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorGemini Lasswell2018-08-03 10:28:28 -0700
committerGemini Lasswell2018-08-03 10:28:28 -0700
commitda0054c30729e58259c1e7251cb03c8ef13ff943 (patch)
treef3fd4b5256aa6c6786d0ac4f80fb1d87dcc2e401 /doc
parente65ec81fc3e556719fae8d8b4b42f571c7e9f4fc (diff)
parent95b2ab3dccdc756614b4c8f45a7b206d61753705 (diff)
downloademacs-da0054c30729e58259c1e7251cb03c8ef13ff943.tar.gz
emacs-da0054c30729e58259c1e7251cb03c8ef13ff943.zip
Merge branch 'scratch/backtrace-mode'
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/debugging.texi115
-rw-r--r--doc/lispref/edebug.texi12
-rw-r--r--doc/misc/ert.texi8
3 files changed, 99 insertions, 36 deletions
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 1b1f87465db..9b3ba6cf7ee 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -81,7 +81,8 @@ debugger recursively. @xref{Recursive Editing}.
81* Function Debugging:: Entering it when a certain function is called. 81* Function Debugging:: Entering it when a certain function is called.
82* Variable Debugging:: Entering it when a variable is modified. 82* Variable Debugging:: Entering it when a variable is modified.
83* Explicit Debug:: Entering it at a certain point in the program. 83* Explicit Debug:: Entering it at a certain point in the program.
84* Using Debugger:: What the debugger does; what you see while in it. 84* Using Debugger:: What the debugger does.
85* Backtraces:: What you see while in the debugger.
85* Debugger Commands:: Commands used while in the debugger. 86* Debugger Commands:: Commands used while in the debugger.
86* Invoking the Debugger:: How to call the function @code{debug}. 87* Invoking the Debugger:: How to call the function @code{debug}.
87* Internals of Debugger:: Subroutines of the debugger, and global variables. 88* Internals of Debugger:: Subroutines of the debugger, and global variables.
@@ -392,32 +393,82 @@ this is not what you want, you can either set
392@code{eval-expression-debug-on-error} to @code{nil}, or set 393@code{eval-expression-debug-on-error} to @code{nil}, or set
393@code{debug-on-error} to @code{nil} in @code{debugger-mode-hook}. 394@code{debug-on-error} to @code{nil} in @code{debugger-mode-hook}.
394 395
396 The debugger itself must be run byte-compiled, since it makes
397assumptions about the state of the Lisp interpreter. These
398assumptions are false if the debugger is running interpreted.
399
400@node Backtraces
401@subsection Backtraces
402@cindex backtrace buffer
403
404Debugger mode is derived from Backtrace mode, which is also used to
405show backtraces by Edebug and ERT. (@pxref{Edebug}, and @ref{Top,the
406ERT manual,, ert, ERT: Emacs Lisp Regression Testing}.)
407
408@cindex stack frame
409The backtrace buffer shows you the functions that are executing and
410their argument values. When a backtrace buffer is created, it shows
411each stack frame on one, possibly very long, line. (A stack frame is
412the place where the Lisp interpreter records information about a
413particular invocation of a function.) The most recently called
414function will be at the top.
415
395@cindex current stack frame 416@cindex current stack frame
396 The backtrace buffer shows you the functions that are executing and 417In a backtrace you can specify a stack frame by moving point to a line
397their argument values. It also allows you to specify a stack frame by 418describing that frame. The frame whose line point is on is considered
398moving point to the line describing that frame. (A stack frame is the 419the @dfn{current frame}.
399place where the Lisp interpreter records information about a particular 420
400invocation of a function.) The frame whose line point is on is 421If a function name is underlined, that means Emacs knows where its
401considered the @dfn{current frame}. Some of the debugger commands 422source code is located. You can click with the mouse on that name, or
402operate on the current frame. If a line starts with a star, that means 423move to it and type @key{RET}, to visit the source code. You can also
403that exiting that frame will call the debugger again. This is useful 424type @key{RET} while point is on any name of a function or variable
404for examining the return value of a function. 425which is not underlined, to see help information for that symbol in a
405 426help buffer, if any exists. The @code{xref-find-definitions} command,
406 If a function name is underlined, that means the debugger knows 427bound to @key{M-.}, can also be used on any identifier in a backtrace
407where its source code is located. You can click with the mouse on 428(@pxref{Looking Up Identifiers,,,emacs, The GNU Emacs Manual}).
408that name, or move to it and type @key{RET}, to visit the source code. 429
430In backtraces, the tails of long lists and the ends of long strings,
431vectors or structures, as well as objects which are deeply nested,
432will be printed as underlined ``...''. You can click with the mouse
433on a ``...'', or type @key{RET} while point is on it, to show the part
434of the object that was hidden. To control how much abbreviation is
435done, customize @code{backtrace-line-length}.
436
437Here is a list of commands for navigating and viewing backtraces:
409 438
410 The debugger itself must be run byte-compiled, since it makes 439@table @kbd
411assumptions about how many stack frames are used for the debugger 440@item v
412itself. These assumptions are false if the debugger is running 441Toggle the display of local variables of the current stack frame.
413interpreted. 442
443@item p
444Move to the beginning of the frame, or to the beginning
445of the previous frame.
446
447@item n
448Move to the beginning of the next frame.
449
450@item +
451Add line breaks and indentation to the top-level Lisp form at point to
452make it more readable.
453
454@item -
455Collapse the top-level Lisp form at point back to a single line.
456
457@item #
458Toggle @code{print-circle} for the frame at point.
459
460@item .
461Expand all the forms abbreviated with ``...'' in the frame at point.
462
463@end table
414 464
415@node Debugger Commands 465@node Debugger Commands
416@subsection Debugger Commands 466@subsection Debugger Commands
417@cindex debugger command list 467@cindex debugger command list
418 468
419 The debugger buffer (in Debugger mode) provides special commands in 469 The debugger buffer (in Debugger mode) provides special commands in
420addition to the usual Emacs commands. The most important use of 470addition to the usual Emacs commands and to the Backtrace mode commands
471described in the previous section. The most important use of
421debugger commands is for stepping through code, so that you can see 472debugger commands is for stepping through code, so that you can see
422how control flows. The debugger can step through the control 473how control flows. The debugger can step through the control
423structures of an interpreted function, but cannot do so in a 474structures of an interpreted function, but cannot do so in a
@@ -427,6 +478,11 @@ the same function. (To do this, visit the source for the function and
427type @kbd{C-M-x} on its definition.) You cannot use the Lisp debugger 478type @kbd{C-M-x} on its definition.) You cannot use the Lisp debugger
428to step through a primitive function. 479to step through a primitive function.
429 480
481Some of the debugger commands operate on the current frame. If a
482frame starts with a star, that means that exiting that frame will call the
483debugger again. This is useful for examining the return value of a
484function.
485
430@c FIXME: Add @findex for the following commands? --xfq 486@c FIXME: Add @findex for the following commands? --xfq
431 Here is a list of Debugger mode commands: 487 Here is a list of Debugger mode commands:
432 488
@@ -502,8 +558,6 @@ Display a list of functions that will invoke the debugger when called.
502This is a list of functions that are set to break on entry by means of 558This is a list of functions that are set to break on entry by means of
503@code{debug-on-entry}. 559@code{debug-on-entry}.
504 560
505@item v
506Toggle the display of local variables of the current stack frame.
507@end table 561@end table
508 562
509@node Invoking the Debugger 563@node Invoking the Debugger
@@ -624,20 +678,19 @@ of @code{debug} (@pxref{Invoking the Debugger}).
624@cindex run time stack 678@cindex run time stack
625@cindex call stack 679@cindex call stack
626This function prints a trace of Lisp function calls currently active. 680This function prints a trace of Lisp function calls currently active.
627This is the function used by @code{debug} to fill up the 681The trace is identical to the one that @code{debug} would show in the
628@file{*Backtrace*} buffer. It is written in C, since it must have access 682@file{*Backtrace*} buffer. The return value is always nil.
629to the stack to determine which function calls are active. The return
630value is always @code{nil}.
631 683
632In the following example, a Lisp expression calls @code{backtrace} 684In the following example, a Lisp expression calls @code{backtrace}
633explicitly. This prints the backtrace to the stream 685explicitly. This prints the backtrace to the stream
634@code{standard-output}, which, in this case, is the buffer 686@code{standard-output}, which, in this case, is the buffer
635@samp{backtrace-output}. 687@samp{backtrace-output}.
636 688
637Each line of the backtrace represents one function call. The line shows 689Each line of the backtrace represents one function call. The line
638the values of the function's arguments if they are all known; if they 690shows the function followed by a list of the values of the function's
639are still being computed, the line says so. The arguments of special 691arguments if they are all known; if they are still being computed, the
640forms are elided. 692line consists of a list containing the function and its unevaluated
693arguments. Long lists or deeply nested structures may be elided.
641 694
642@smallexample 695@smallexample
643@group 696@group
@@ -654,7 +707,7 @@ forms are elided.
654@group 707@group
655----------- Buffer: backtrace-output ------------ 708----------- Buffer: backtrace-output ------------
656 backtrace() 709 backtrace()
657 (list ...computing arguments...) 710 (list 'testing (backtrace))
658@end group 711@end group
659 (progn ...) 712 (progn ...)
660 eval((progn (1+ var) (list 'testing (backtrace)))) 713 eval((progn (1+ var) (list 'testing (backtrace))))
@@ -685,7 +738,7 @@ example would look as follows:
685@group 738@group
686----------- Buffer: backtrace-output ------------ 739----------- Buffer: backtrace-output ------------
687 (backtrace) 740 (backtrace)
688 (list ...computing arguments...) 741 (list 'testing (backtrace))
689@end group 742@end group
690 (progn ...) 743 (progn ...)
691 (eval (progn (1+ var) (list 'testing (backtrace)))) 744 (eval (progn (1+ var) (list 'testing (backtrace))))
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
index b9cc1d5afc2..54200b99903 100644
--- a/doc/lispref/edebug.texi
+++ b/doc/lispref/edebug.texi
@@ -442,8 +442,16 @@ Redisplay the most recently known expression result in the echo area
442Display a backtrace, excluding Edebug's own functions for clarity 442Display a backtrace, excluding Edebug's own functions for clarity
443(@code{edebug-backtrace}). 443(@code{edebug-backtrace}).
444 444
445You cannot use debugger commands in the backtrace buffer in Edebug as 445@xref{Backtraces}, for a description of backtraces
446you would in the standard debugger. 446and the commands which work on them.
447
448If you would like to see Edebug's functions in the backtrace,
449use @kbd{M-x edebug-backtrace-show-instrumentation}. To hide them
450again use @kbd{M-x edebug-backtrace-hide-instrumentation}.
451
452If a backtrace frame starts with @samp{>} that means that Edebug knows
453where the source code for the frame is located. Use @kbd{s} to jump
454to the source code for the current frame.
447 455
448The backtrace buffer is killed automatically when you continue 456The backtrace buffer is killed automatically when you continue
449execution. 457execution.
diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi
index 82e0e27ed1c..6a34f5c5722 100644
--- a/doc/misc/ert.texi
+++ b/doc/misc/ert.texi
@@ -273,9 +273,11 @@ moving point to it and typing @kbd{@key{RET}} jumps to its definition.
273@cindex backtrace of a failed test 273@cindex backtrace of a failed test
274Pressing @kbd{r} re-runs the test near point on its own. Pressing 274Pressing @kbd{r} re-runs the test near point on its own. Pressing
275@kbd{d} re-runs it with the debugger enabled. @kbd{.} jumps to the 275@kbd{d} re-runs it with the debugger enabled. @kbd{.} jumps to the
276definition of the test near point (@kbd{@key{RET}} has the same effect if 276definition of the test near point (@kbd{@key{RET}} has the same effect
277point is on the name of the test). On a failed test, @kbd{b} shows 277if point is on the name of the test). On a failed test, @kbd{b} shows
278the backtrace of the failure. 278the backtrace of the failure. @xref{Debugging,, Backtraces, elisp,
279GNU Emacs Lisp Reference Manual}, for more information about
280backtraces.
279 281
280@kindex l@r{, in ert results buffer} 282@kindex l@r{, in ert results buffer}
281@kbd{l} shows the list of @code{should} forms executed in the test. 283@kbd{l} shows the list of @code{should} forms executed in the test.