Function: backtrace-eval
backtrace-eval is a function defined in eval.c.
Signature
(backtrace-eval EXP NFRAMES &optional BASE)
Documentation
Evaluate EXP in the context of some activation frame.
NFRAMES and BASE specify the activation frame to use, as in backtrace-frame.
Source Code
// Defined in /usr/src/emacs/src/eval.c
{
union specbinding *pdl = get_backtrace_frame (nframes, base);
specpdl_ref count = SPECPDL_INDEX ();
ptrdiff_t distance = specpdl_ptr - pdl;
eassert (distance >= 0);
if (!backtrace_p (pdl))
error ("Activation frame not found!");
backtrace_eval_unrewind (distance);
record_unwind_protect_int (backtrace_eval_unrewind, -distance);
/* Use eval_sub rather than Feval since the main motivation behind
backtrace-eval is to be able to get/set the value of lexical variables
from the debugger. */
return unbind_to (count, eval_sub (exp));
}