Commit 9cad4576 authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

* eval.c (call_debugger): Grow specpdl if the debugger was

entered due to specpdl overflow (Bug#16603) and allow more
specpdl space for the debugger itself.
parent 7bcbca40
......@@ -2,6 +2,9 @@
* print.c (Fexternal_debugging_output): Add cast to pacify
--enable-gcc-warnings.
* eval.c (call_debugger): Grow specpdl if the debugger was
entered due to specpdl overflow (Bug#16603) and allow more
specpdl space for the debugger itself.
2014-02-02 Martin Rudalics <rudalics@gmx.at>
......
......@@ -273,6 +273,8 @@ restore_stack_limits (Lisp_Object data)
max_lisp_eval_depth = XINT (XCDR (data));
}
static void grow_specpdl (void);
/* Call the Lisp debugger, giving it argument ARG. */
Lisp_Object
......@@ -281,22 +283,27 @@ call_debugger (Lisp_Object arg)
bool debug_while_redisplaying;
ptrdiff_t count = SPECPDL_INDEX ();
Lisp_Object val;
EMACS_INT old_max = max_specpdl_size;
/* Temporarily bump up the stack limits,
so the debugger won't run out of stack. */
max_specpdl_size += 1;
record_unwind_protect (restore_stack_limits,
Fcons (make_number (old_max),
make_number (max_lisp_eval_depth)));
max_specpdl_size = old_max;
EMACS_INT old_max = max_specpdl_size, old_depth = max_lisp_eval_depth;
if (lisp_eval_depth + 40 > max_lisp_eval_depth)
max_lisp_eval_depth = lisp_eval_depth + 40;
if (max_specpdl_size - 100 < SPECPDL_INDEX ())
max_specpdl_size = SPECPDL_INDEX () + 100;
/* While debugging Bug#16603, previous value of 100 was found
too small to avoid specpdl overflow in the debugger itself. */
if (max_specpdl_size - 200 < count)
max_specpdl_size = count + 200;
if (old_max == count)
{
/* We can enter the debugger due to specpdl overflow (Bug#16603). */
specpdl_ptr--;
grow_specpdl ();
}
/* Restore limits after leaving the debugger. */
record_unwind_protect (restore_stack_limits,
Fcons (make_number (old_max),
make_number (old_depth)));
#ifdef HAVE_WINDOW_SYSTEM
if (display_hourglass_p)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment