diff options
| author | Clément Pit--Claudel | 2016-12-05 00:52:14 -0500 |
|---|---|---|
| committer | Clément Pit--Claudel | 2016-12-12 17:41:27 -0500 |
| commit | 27cada035a79b633e856a437dd0e037acc1d61c6 (patch) | |
| tree | b02c80fe4e7b4ce9fe54912118e4fa5e723723c5 /doc | |
| parent | a41ded87b318ce3cbeb0ba3624bcb83ae3b8a437 (diff) | |
| download | emacs-27cada035a79b633e856a437dd0e037acc1d61c6.tar.gz emacs-27cada035a79b633e856a437dd0e037acc1d61c6.zip | |
Move backtrace to ELisp using a new mapbacktrace primitive
* src/eval.c (get_backtrace_starting_at, backtrace_frame_apply)
(Fmapbacktrace, Fbacktrace_frame_internal): New functions.
(get_backtrace_frame, Fbacktrace_debug): Use `get_backtrace_starting_at'.
* lisp/subr.el (backtrace--print-frame): New function.
(backtrace): Reimplement using `backtrace--print-frame' and `mapbacktrace'.
(backtrace-frame): Reimplement using `backtrace-frame--internal'.
* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Pass a base to
`mapbacktrace' instead of searching for "(debug" in the output of
`backtrace'.
* test/lisp/subr-tests.el (subr-test-backtrace-simple-tests)
(subr-test-backtrace-integration-test): New tests.
* doc/lispref/debugging.texi (Internals of Debugger): Document
`mapbacktrace' and missing argument BASE of `backtrace-frame'.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/debugging.texi | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index c80b0f95b37..8fb663d2aee 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi | |||
| @@ -727,7 +727,7 @@ invocation. | |||
| 727 | This variable is obsolete and will be removed in future versions. | 727 | This variable is obsolete and will be removed in future versions. |
| 728 | @end defvar | 728 | @end defvar |
| 729 | 729 | ||
| 730 | @defun backtrace-frame frame-number | 730 | @defun backtrace-frame frame-number &optional base |
| 731 | The function @code{backtrace-frame} is intended for use in Lisp | 731 | The function @code{backtrace-frame} is intended for use in Lisp |
| 732 | debuggers. It returns information about what computation is happening | 732 | debuggers. It returns information about what computation is happening |
| 733 | in the stack frame @var{frame-number} levels down. | 733 | in the stack frame @var{frame-number} levels down. |
| @@ -744,10 +744,31 @@ In the return value, @var{function} is whatever was supplied as the | |||
| 744 | case of a macro call. If the function has a @code{&rest} argument, that | 744 | case of a macro call. If the function has a @code{&rest} argument, that |
| 745 | is represented as the tail of the list @var{arg-values}. | 745 | is represented as the tail of the list @var{arg-values}. |
| 746 | 746 | ||
| 747 | If @var{base} is specified, @var{frame-number} counts relative to | ||
| 748 | the topmost frame whose @var{function} is @var{base}. | ||
| 749 | |||
| 747 | If @var{frame-number} is out of range, @code{backtrace-frame} returns | 750 | If @var{frame-number} is out of range, @code{backtrace-frame} returns |
| 748 | @code{nil}. | 751 | @code{nil}. |
| 749 | @end defun | 752 | @end defun |
| 750 | 753 | ||
| 754 | @defun mapbacktrace function &optional base | ||
| 755 | The function @code{mapbacktrace} calls @var{function} once for each | ||
| 756 | frame in the backtrace, starting at the first frame whose function is | ||
| 757 | @var{base} (or from the top if @var{base} is omitted or @code{nil}). | ||
| 758 | |||
| 759 | @var{function} is called with four arguments: @var{evald}, @var{func}, | ||
| 760 | @var{args}, and @var{flags}. | ||
| 761 | |||
| 762 | If a frame has not evaluated its arguments yet or is a special form, | ||
| 763 | @var{evald} is @code{nil} and @var{args} is a list of forms. | ||
| 764 | |||
| 765 | If a frame has evaluated its arguments and called its function | ||
| 766 | already, @var{evald} is @code{t} and @var{args} is a list of values. | ||
| 767 | @var{flags} is a plist of properties of the current frame: currently, | ||
| 768 | the only supported property is @code{:debug-on-exit}, which is | ||
| 769 | @code{t} if the stack frame's @code{debug-on-exit} flag is set. | ||
| 770 | @end defun | ||
| 771 | |||
| 751 | @include edebug.texi | 772 | @include edebug.texi |
| 752 | 773 | ||
| 753 | @node Syntax Errors | 774 | @node Syntax Errors |