emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116255: * eval.c (call_debugger): Grow specpdl if t


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r116255: * eval.c (call_debugger): Grow specpdl if the debugger was
Date: Mon, 03 Feb 2014 09:38:00 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116255
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Mon 2014-02-03 13:37:43 +0400
message:
  * 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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/eval.c                     eval.c-20091113204419-o5vbwnq5f7feedwu-237
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-02-03 07:05:28 +0000
+++ b/src/ChangeLog     2014-02-03 09:37:43 +0000
@@ -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  <address@hidden>
 

=== modified file 'src/eval.c'
--- a/src/eval.c        2014-01-25 03:48:29 +0000
+++ b/src/eval.c        2014-02-03 09:37:43 +0000
@@ -273,6 +273,8 @@
   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 @@
   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;
+  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;
+
+  /* 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 (max_lisp_eval_depth)));
-  max_specpdl_size = old_max;
-
-  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;
+                               make_number (old_depth)));
 
 #ifdef HAVE_WINDOW_SYSTEM
   if (display_hourglass_p)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]