diff options
| author | Gerd Moellmann | 2000-07-05 19:57:23 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-07-05 19:57:23 +0000 |
| commit | 4c576a83921d97cc744200c510fac5aa18e030f8 (patch) | |
| tree | 24a351d5d531d4ce463780828cf59a2f70f5cc2f /src/eval.c | |
| parent | 80fcd514bbc519721a2c11e479c6fd1f0f6efb96 (diff) | |
| download | emacs-4c576a83921d97cc744200c510fac5aa18e030f8.tar.gz emacs-4c576a83921d97cc744200c510fac5aa18e030f8.zip | |
(handling_signal): New variable.
(Fsignal): Abort if handling_signal is non-zero.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 75 |
1 files changed, 46 insertions, 29 deletions
diff --git a/src/eval.c b/src/eval.c index d59ceb38eac..56842ac99f3 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -32,17 +32,17 @@ Boston, MA 02111-1307, USA. */ | |||
| 32 | /* Putting it in lisp.h makes cc bomb out! */ | 32 | /* Putting it in lisp.h makes cc bomb out! */ |
| 33 | 33 | ||
| 34 | struct backtrace | 34 | struct backtrace |
| 35 | { | 35 | { |
| 36 | struct backtrace *next; | 36 | struct backtrace *next; |
| 37 | Lisp_Object *function; | 37 | Lisp_Object *function; |
| 38 | Lisp_Object *args; /* Points to vector of args. */ | 38 | Lisp_Object *args; /* Points to vector of args. */ |
| 39 | int nargs; /* Length of vector. | 39 | int nargs; /* Length of vector. |
| 40 | If nargs is UNEVALLED, args points to slot holding | 40 | If nargs is UNEVALLED, args points to slot holding |
| 41 | list of unevalled args */ | 41 | list of unevalled args */ |
| 42 | char evalargs; | 42 | char evalargs; |
| 43 | /* Nonzero means call value of debugger when done with this operation. */ | 43 | /* Nonzero means call value of debugger when done with this operation. */ |
| 44 | char debug_on_exit; | 44 | char debug_on_exit; |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | struct backtrace *backtrace_list; | 47 | struct backtrace *backtrace_list; |
| 48 | 48 | ||
| @@ -64,20 +64,21 @@ struct backtrace *backtrace_list; | |||
| 64 | 64 | ||
| 65 | All the other members are concerned with restoring the interpreter | 65 | All the other members are concerned with restoring the interpreter |
| 66 | state. */ | 66 | state. */ |
| 67 | |||
| 67 | struct catchtag | 68 | struct catchtag |
| 68 | { | 69 | { |
| 69 | Lisp_Object tag; | 70 | Lisp_Object tag; |
| 70 | Lisp_Object val; | 71 | Lisp_Object val; |
| 71 | struct catchtag *next; | 72 | struct catchtag *next; |
| 72 | struct gcpro *gcpro; | 73 | struct gcpro *gcpro; |
| 73 | jmp_buf jmp; | 74 | jmp_buf jmp; |
| 74 | struct backtrace *backlist; | 75 | struct backtrace *backlist; |
| 75 | struct handler *handlerlist; | 76 | struct handler *handlerlist; |
| 76 | int lisp_eval_depth; | 77 | int lisp_eval_depth; |
| 77 | int pdlcount; | 78 | int pdlcount; |
| 78 | int poll_suppress_count; | 79 | int poll_suppress_count; |
| 79 | struct byte_stack *byte_stack; | 80 | struct byte_stack *byte_stack; |
| 80 | }; | 81 | }; |
| 81 | 82 | ||
| 82 | struct catchtag *catchlist; | 83 | struct catchtag *catchlist; |
| 83 | 84 | ||
| @@ -95,6 +96,7 @@ Lisp_Object Qdebug_on_error; | |||
| 95 | /* This holds either the symbol `run-hooks' or nil. | 96 | /* This holds either the symbol `run-hooks' or nil. |
| 96 | It is nil at an early stage of startup, and when Emacs | 97 | It is nil at an early stage of startup, and when Emacs |
| 97 | is shutting down. */ | 98 | is shutting down. */ |
| 99 | |||
| 98 | Lisp_Object Vrun_hooks; | 100 | Lisp_Object Vrun_hooks; |
| 99 | 101 | ||
| 100 | /* Non-nil means record all fset's and provide's, to be undone | 102 | /* Non-nil means record all fset's and provide's, to be undone |
| @@ -105,24 +107,31 @@ Lisp_Object Vrun_hooks; | |||
| 105 | Lisp_Object Vautoload_queue; | 107 | Lisp_Object Vautoload_queue; |
| 106 | 108 | ||
| 107 | /* Current number of specbindings allocated in specpdl. */ | 109 | /* Current number of specbindings allocated in specpdl. */ |
| 110 | |||
| 108 | int specpdl_size; | 111 | int specpdl_size; |
| 109 | 112 | ||
| 110 | /* Pointer to beginning of specpdl. */ | 113 | /* Pointer to beginning of specpdl. */ |
| 114 | |||
| 111 | struct specbinding *specpdl; | 115 | struct specbinding *specpdl; |
| 112 | 116 | ||
| 113 | /* Pointer to first unused element in specpdl. */ | 117 | /* Pointer to first unused element in specpdl. */ |
| 118 | |||
| 114 | struct specbinding *specpdl_ptr; | 119 | struct specbinding *specpdl_ptr; |
| 115 | 120 | ||
| 116 | /* Maximum size allowed for specpdl allocation */ | 121 | /* Maximum size allowed for specpdl allocation */ |
| 122 | |||
| 117 | int max_specpdl_size; | 123 | int max_specpdl_size; |
| 118 | 124 | ||
| 119 | /* Depth in Lisp evaluations and function calls. */ | 125 | /* Depth in Lisp evaluations and function calls. */ |
| 126 | |||
| 120 | int lisp_eval_depth; | 127 | int lisp_eval_depth; |
| 121 | 128 | ||
| 122 | /* Maximum allowed depth in Lisp evaluations and function calls. */ | 129 | /* Maximum allowed depth in Lisp evaluations and function calls. */ |
| 130 | |||
| 123 | int max_lisp_eval_depth; | 131 | int max_lisp_eval_depth; |
| 124 | 132 | ||
| 125 | /* Nonzero means enter debugger before next function call */ | 133 | /* Nonzero means enter debugger before next function call */ |
| 134 | |||
| 126 | int debug_on_next_call; | 135 | int debug_on_next_call; |
| 127 | 136 | ||
| 128 | /* Non-zero means debuffer may continue. This is zero when the | 137 | /* Non-zero means debuffer may continue. This is zero when the |
| @@ -133,24 +142,30 @@ int debugger_may_continue; | |||
| 133 | 142 | ||
| 134 | /* List of conditions (non-nil atom means all) which cause a backtrace | 143 | /* List of conditions (non-nil atom means all) which cause a backtrace |
| 135 | if an error is handled by the command loop's error handler. */ | 144 | if an error is handled by the command loop's error handler. */ |
| 145 | |||
| 136 | Lisp_Object Vstack_trace_on_error; | 146 | Lisp_Object Vstack_trace_on_error; |
| 137 | 147 | ||
| 138 | /* List of conditions (non-nil atom means all) which enter the debugger | 148 | /* List of conditions (non-nil atom means all) which enter the debugger |
| 139 | if an error is handled by the command loop's error handler. */ | 149 | if an error is handled by the command loop's error handler. */ |
| 150 | |||
| 140 | Lisp_Object Vdebug_on_error; | 151 | Lisp_Object Vdebug_on_error; |
| 141 | 152 | ||
| 142 | /* List of conditions and regexps specifying error messages which | 153 | /* List of conditions and regexps specifying error messages which |
| 143 | do not enter the debugger even if Vdebug_on_errors says they should. */ | 154 | do not enter the debugger even if Vdebug_on_errors says they should. */ |
| 155 | |||
| 144 | Lisp_Object Vdebug_ignored_errors; | 156 | Lisp_Object Vdebug_ignored_errors; |
| 145 | 157 | ||
| 146 | /* Non-nil means call the debugger even if the error will be handled. */ | 158 | /* Non-nil means call the debugger even if the error will be handled. */ |
| 159 | |||
| 147 | Lisp_Object Vdebug_on_signal; | 160 | Lisp_Object Vdebug_on_signal; |
| 148 | 161 | ||
| 149 | /* Hook for edebug to use. */ | 162 | /* Hook for edebug to use. */ |
| 163 | |||
| 150 | Lisp_Object Vsignal_hook_function; | 164 | Lisp_Object Vsignal_hook_function; |
| 151 | 165 | ||
| 152 | /* Nonzero means enter debugger if a quit signal | 166 | /* Nonzero means enter debugger if a quit signal |
| 153 | is handled by the command loop's error handler. */ | 167 | is handled by the command loop's error handler. */ |
| 168 | |||
| 154 | int debug_on_quit; | 169 | int debug_on_quit; |
| 155 | 170 | ||
| 156 | /* The value of num_nonmacro_input_events as of the last time we | 171 | /* The value of num_nonmacro_input_events as of the last time we |
| @@ -159,6 +174,7 @@ int debug_on_quit; | |||
| 159 | know that the debugger itself has an error, and we should just | 174 | know that the debugger itself has an error, and we should just |
| 160 | signal the error instead of entering an infinite loop of debugger | 175 | signal the error instead of entering an infinite loop of debugger |
| 161 | invocations. */ | 176 | invocations. */ |
| 177 | |||
| 162 | int when_entered_debugger; | 178 | int when_entered_debugger; |
| 163 | 179 | ||
| 164 | Lisp_Object Vdebugger; | 180 | Lisp_Object Vdebugger; |
| @@ -168,6 +184,12 @@ Lisp_Object Vdebugger; | |||
| 168 | 184 | ||
| 169 | Lisp_Object Vsignaling_function; | 185 | Lisp_Object Vsignaling_function; |
| 170 | 186 | ||
| 187 | /* Set to non-zero while processing X events. Checked in Feval to | ||
| 188 | make sure the Lisp interpreter isn't called from a signal handler, | ||
| 189 | which is unsafe because the interpreter isn't reentrant. */ | ||
| 190 | |||
| 191 | int handling_signal; | ||
| 192 | |||
| 171 | void specbind (), record_unwind_protect (); | 193 | void specbind (), record_unwind_protect (); |
| 172 | 194 | ||
| 173 | Lisp_Object run_hook_with_args (); | 195 | Lisp_Object run_hook_with_args (); |
| @@ -1769,6 +1791,7 @@ do_autoload (fundef, funname) | |||
| 1769 | XSYMBOL (funname)->name->data); | 1791 | XSYMBOL (funname)->name->data); |
| 1770 | UNGCPRO; | 1792 | UNGCPRO; |
| 1771 | } | 1793 | } |
| 1794 | |||
| 1772 | 1795 | ||
| 1773 | DEFUN ("eval", Feval, Seval, 1, 1, 0, | 1796 | DEFUN ("eval", Feval, Seval, 1, 1, 0, |
| 1774 | "Evaluate FORM and return its value.") | 1797 | "Evaluate FORM and return its value.") |
| @@ -1780,14 +1803,8 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 1780 | struct backtrace backtrace; | 1803 | struct backtrace backtrace; |
| 1781 | struct gcpro gcpro1, gcpro2, gcpro3; | 1804 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 1782 | 1805 | ||
| 1783 | #if 0 /* Can't do this check anymore because realize_basic_faces has | 1806 | if (handling_signal) |
| 1784 | to BLOCK_INPUT, and can call Lisp. What's really needed is a | ||
| 1785 | flag indicating that we're currently handling a signal. */ | ||
| 1786 | /* Since Fsignal resets this to 0, it had better be 0 now | ||
| 1787 | or else we have a potential bug. */ | ||
| 1788 | if (interrupt_input_blocked != 0) | ||
| 1789 | abort (); | 1807 | abort (); |
| 1790 | #endif | ||
| 1791 | 1808 | ||
| 1792 | if (SYMBOLP (form)) | 1809 | if (SYMBOLP (form)) |
| 1793 | { | 1810 | { |