summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2019-04-08 17:57:22 -0400
committerNoam Postavsky <npostavs@gmail.com>2019-04-14 22:43:38 -0400
commit9800df69cb7003bda1f2b98d6f11e89ba95afb9b (patch)
tree8de5b8b10e6a0743b7f227bef6bf87ffdb98ed4a /src/eval.c
parentfc0f469fb5b5eb28ca4d9948190be6cb1bd8156e (diff)
downloademacs-9800df69cb7003bda1f2b98d6f11e89ba95afb9b.tar.gz
Let debugger handle process spawn errors on w32 (Bug#33016)
Since child_setup() is called between block_input()...unblock_input(), when an error is signaled the Lisp debugger is prevented from starting. Therefore, let the callers signal the error instead (which they already do for non-w32 platforms, just the error message needs an update). * src/callproc.c (child_setup) [WINDOWSNT]: Don't call report_file_error here. (call_process) [WINDOWNT]: * src/process.c (create_process) [WINDOWSNT]: Call report_file_errno here instead, after the unblock_input() call, same as for !WINDOWSNT. * src/lisp.h (CHILD_SETUP_ERROR_DESC): New preprocessor define. Flip the containing ifndef DOS_NT branches so that it's ifdef DOS_NT. * src/eval.c (when_entered_debugger): Remove. (syms_of_eval) <internal-when-entered-debugger>: Define it as a Lisp integer variable instead. (maybe_call_debugger): Update comment. * test/src/process-tests.el (make-process-w32-debug-spawn-error): * test/src/callproc-tests.el (call-process-w32-debug-spawn-error): New tests.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/eval.c b/src/eval.c
index e9f118c5cb9..fa7b2d06031 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -52,15 +52,6 @@ Lisp_Object Vautoload_queue;
is shutting down. */
Lisp_Object Vrun_hooks;
-/* The value of num_nonmacro_input_events as of the last time we
- started to enter the debugger. If we decide to enter the debugger
- again when this is still equal to num_nonmacro_input_events, then we
- know that the debugger itself has an error, and we should just
- signal the error instead of entering an infinite loop of debugger
- invocations. */
-
-static intmax_t when_entered_debugger;
-
/* The function from which the last `signal' was called. Set in
Fsignal. */
/* FIXME: We should probably get rid of this! */
@@ -1835,7 +1826,8 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
? debug_on_quit
: wants_debugger (Vdebug_on_error, conditions))
&& ! skip_debugger (conditions, combined_data)
- /* RMS: What's this for? */
+ /* See commentary on definition of
+ `internal-when-entered-debugger'. */
&& when_entered_debugger < num_nonmacro_input_events)
{
call_debugger (list2 (Qerror, combined_data));
@@ -4170,6 +4162,18 @@ Note that `debug-on-error', `debug-on-quit' and friends
still determine whether to handle the particular condition. */);
Vdebug_on_signal = Qnil;
+ /* The value of num_nonmacro_input_events as of the last time we
+ started to enter the debugger. If we decide to enter the debugger
+ again when this is still equal to num_nonmacro_input_events, then we
+ know that the debugger itself has an error, and we should just
+ signal the error instead of entering an infinite loop of debugger
+ invocations. */
+ DEFSYM (Qinternal_when_entered_debugger, "internal-when-entered-debugger");
+ DEFVAR_INT ("internal-when-entered-debugger", when_entered_debugger,
+ doc: /* The number of keyboard events as of last time `debugger' was called.
+Used to avoid infinite loops if the debugger itself has an error.
+Don't set this unless you're sure that can't happen. */);
+
/* When lexical binding is being used,
Vinternal_interpreter_environment is non-nil, and contains an alist
of lexically-bound variable, or (t), indicating an empty