Lisp_Object funcar;
ptrdiff_t count;
+ /* Declare here, as this array may be accessed by call_debugger near
+ the end of this function. See Bug#21245. */
+ Lisp_Object argvals[8];
+
if (SYMBOLP (form))
{
/* Look up its binding in the lexical environment.
if (SUBRP (fun))
{
- Lisp_Object numargs;
- Lisp_Object argvals[8];
- Lisp_Object args_left;
- register int i, maxargs;
-
- args_left = original_args;
- numargs = Flength (args_left);
+ Lisp_Object args_left = original_args;
+ Lisp_Object numargs = Flength (args_left);
check_cons_list ();
set_backtrace_args (specpdl + count, vals, XINT (numargs));
val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals);
+
+ check_cons_list ();
+ lisp_eval_depth--;
+ /* Do the debug-on-exit now, while VALS still exists. */
+ if (backtrace_debug_on_exit (specpdl + count))
+ val = call_debugger (list2 (Qexit, val));
SAFE_FREE ();
+ specpdl_ptr--;
+ return val;
}
else
{
- maxargs = XSUBR (fun)->max_args;
+ int i, maxargs = XSUBR (fun)->max_args;
+
for (i = 0; i < maxargs; i++)
{
argvals[i] = eval_sub (Fcar (args_left));
}
}
else if (COMPILEDP (fun))
- val = apply_lambda (fun, original_args, count);
+ return apply_lambda (fun, original_args, count);
else
{
if (NILP (fun))
}
else if (EQ (funcar, Qlambda)
|| EQ (funcar, Qclosure))
- val = apply_lambda (fun, original_args, count);
+ return apply_lambda (fun, original_args, count);
else
xsignal1 (Qinvalid_function, original_fun);
}
set_backtrace_args (specpdl + count, arg_vector, i);
tem = funcall_lambda (fun, numargs, arg_vector);
+ check_cons_list ();
+ lisp_eval_depth--;
/* Do the debug-on-exit now, while arg_vector still exists. */
if (backtrace_debug_on_exit (specpdl + count))
- {
- /* Don't do it again when we return to eval. */
- set_backtrace_debug_on_exit (specpdl + count, false);
- tem = call_debugger (list2 (Qexit, tem));
- }
+ tem = call_debugger (list2 (Qexit, tem));
SAFE_FREE ();
+ specpdl_ptr--;
return tem;
}