diff options
author | Clément Pit--Claudel <clement.pitclaudel@live.com> | 2016-12-05 00:52:14 -0500 |
---|---|---|
committer | Clément Pit--Claudel <clement.pitclaudel@live.com> | 2016-12-12 17:41:27 -0500 |
commit | 27cada035a79b633e856a437dd0e037acc1d61c6 (patch) | |
tree | b02c80fe4e7b4ce9fe54912118e4fa5e723723c5 /doc | |
parent | a41ded87b318ce3cbeb0ba3624bcb83ae3b8a437 (diff) | |
download | emacs-27cada035a79b633e856a437dd0e037acc1d61c6.tar.gz emacs-27cada035a79b633e856a437dd0e037acc1d61c6.tar.bz2 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. This variable is obsolete and will be removed in future versions. @end defvar -@defun backtrace-frame frame-number +@defun backtrace-frame frame-number &optional base The function @code{backtrace-frame} is intended for use in Lisp debuggers. It returns information about what computation is happening 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 case of a macro call. If the function has a @code{&rest} argument, that is represented as the tail of the list @var{arg-values}. +If @var{base} is specified, @var{frame-number} counts relative to +the topmost frame whose @var{function} is @var{base}. + If @var{frame-number} is out of range, @code{backtrace-frame} returns @code{nil}. @end defun +@defun mapbacktrace function &optional base +The function @code{mapbacktrace} calls @var{function} once for each +frame in the backtrace, starting at the first frame whose function is +@var{base} (or from the top if @var{base} is omitted or @code{nil}). + +@var{function} is called with four arguments: @var{evald}, @var{func}, +@var{args}, and @var{flags}. + +If a frame has not evaluated its arguments yet or is a special form, +@var{evald} is @code{nil} and @var{args} is a list of forms. + +If a frame has evaluated its arguments and called its function +already, @var{evald} is @code{t} and @var{args} is a list of values. +@var{flags} is a plist of properties of the current frame: currently, +the only supported property is @code{:debug-on-exit}, which is +@code{t} if the stack frame's @code{debug-on-exit} flag is set. +@end defun + @include edebug.texi @node Syntax Errors |