diff options
| author | Richard M. Stallman | 1996-09-27 20:39:38 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-09-27 20:39:38 +0000 |
| commit | 61ede770df31cd298ba1453ab77364eab60aeeb1 (patch) | |
| tree | ca298b995d5dd72501551cbd0f8376c3a507fa55 /src/eval.c | |
| parent | 38f16fe1991b78104e6802d8bcbe910520548690 (diff) | |
| download | emacs-61ede770df31cd298ba1453ab77364eab60aeeb1.tar.gz emacs-61ede770df31cd298ba1453ab77364eab60aeeb1.zip | |
(Vdebug_force): New variable.
(syms_of_eval): Set up Lisp var.
(find_handler_clause): If Vdebug_force, call debugger
even if there are handlers.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/src/eval.c b/src/eval.c index 4f66f44fb40..2772d197e55 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -135,6 +135,12 @@ Lisp_Object Vdebug_on_error; | |||
| 135 | do not enter the debugger even if Vdebug_on_errors says they should. */ | 135 | do not enter the debugger even if Vdebug_on_errors says they should. */ |
| 136 | Lisp_Object Vdebug_ignored_errors; | 136 | Lisp_Object Vdebug_ignored_errors; |
| 137 | 137 | ||
| 138 | /* Non-nil means call the debugger even if the error will be handled. */ | ||
| 139 | Lisp_Object Vdebug_force; | ||
| 140 | |||
| 141 | /* Hook for edebug to use. */ | ||
| 142 | Lisp_Object Vsignal_hook_function; | ||
| 143 | |||
| 138 | /* Nonzero means enter debugger if a quit signal | 144 | /* Nonzero means enter debugger if a quit signal |
| 139 | is handled by the command loop's error handler. */ | 145 | is handled by the command loop's error handler. */ |
| 140 | int debug_on_quit; | 146 | int debug_on_quit; |
| @@ -1211,6 +1217,10 @@ See also the function `condition-case'.") | |||
| 1211 | TOTALLY_UNBLOCK_INPUT; | 1217 | TOTALLY_UNBLOCK_INPUT; |
| 1212 | #endif | 1218 | #endif |
| 1213 | 1219 | ||
| 1220 | /* This hook is used by edebug. */ | ||
| 1221 | if (! NILP (Vsignal_hook_function)) | ||
| 1222 | Ffuncall (Vsignal_hook_function, error_symbol, data); | ||
| 1223 | |||
| 1214 | conditions = Fget (error_symbol, Qerror_conditions); | 1224 | conditions = Fget (error_symbol, Qerror_conditions); |
| 1215 | 1225 | ||
| 1216 | for (; handlerlist; handlerlist = handlerlist->next) | 1226 | for (; handlerlist; handlerlist = handlerlist->next) |
| @@ -1335,8 +1345,15 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |||
| 1335 | 1345 | ||
| 1336 | if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ | 1346 | if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ |
| 1337 | return Qt; | 1347 | return Qt; |
| 1338 | if (EQ (handlers, Qerror)) /* error is used similarly, but means display a backtrace too */ | 1348 | /* error is used similarly, but means print an error message |
| 1349 | and run the debugger if that is enabled. */ | ||
| 1350 | if (EQ (handlers, Qerror) | ||
| 1351 | || !NILP (Vdebug_force)) /* This says call debugger even if | ||
| 1352 | there is a handler. */ | ||
| 1339 | { | 1353 | { |
| 1354 | int count = specpdl_ptr - specpdl; | ||
| 1355 | int debugger_called = 0; | ||
| 1356 | |||
| 1340 | if (wants_debugger (Vstack_trace_on_error, conditions)) | 1357 | if (wants_debugger (Vstack_trace_on_error, conditions)) |
| 1341 | internal_with_output_to_temp_buffer ("*Backtrace*", Fbacktrace, Qnil); | 1358 | internal_with_output_to_temp_buffer ("*Backtrace*", Fbacktrace, Qnil); |
| 1342 | if ((EQ (sig, Qquit) | 1359 | if ((EQ (sig, Qquit) |
| @@ -1345,15 +1362,20 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |||
| 1345 | && ! skip_debugger (conditions, Fcons (sig, data)) | 1362 | && ! skip_debugger (conditions, Fcons (sig, data)) |
| 1346 | && when_entered_debugger < num_nonmacro_input_chars) | 1363 | && when_entered_debugger < num_nonmacro_input_chars) |
| 1347 | { | 1364 | { |
| 1348 | int count = specpdl_ptr - specpdl; | ||
| 1349 | specbind (Qdebug_on_error, Qnil); | 1365 | specbind (Qdebug_on_error, Qnil); |
| 1350 | *debugger_value_ptr | 1366 | *debugger_value_ptr |
| 1351 | = call_debugger (Fcons (Qerror, | 1367 | = call_debugger (Fcons (Qerror, |
| 1352 | Fcons (Fcons (sig, data), | 1368 | Fcons (Fcons (sig, data), |
| 1353 | Qnil))); | 1369 | Qnil))); |
| 1354 | return unbind_to (count, Qlambda); | 1370 | debugger_called = 1; |
| 1371 | } | ||
| 1372 | /* If there is no handler, return saying whether we ran the debugger. */ | ||
| 1373 | if (EQ (handlers, Qerror)) | ||
| 1374 | { | ||
| 1375 | if (debugger_called) | ||
| 1376 | return unbind_to (count, Qlambda); | ||
| 1377 | return Qt; | ||
| 1355 | } | 1378 | } |
| 1356 | return Qt; | ||
| 1357 | } | 1379 | } |
| 1358 | for (h = handlers; CONSP (h); h = Fcdr (h)) | 1380 | for (h = handlers; CONSP (h); h = Fcdr (h)) |
| 1359 | { | 1381 | { |
| @@ -2923,12 +2945,24 @@ If due to `apply' or `funcall' entry, one arg, `lambda'.\n\ | |||
| 2923 | If due to `eval' entry, one arg, t."); | 2945 | If due to `eval' entry, one arg, t."); |
| 2924 | Vdebugger = Qnil; | 2946 | Vdebugger = Qnil; |
| 2925 | 2947 | ||
| 2948 | DEFVAR_LISP ("signal-hook-function", &Vsignal_hook_function, | ||
| 2949 | "If non-nil, this is a function for `signal' to call.\n\ | ||
| 2950 | It receives the same arguments that `signal' was given.\n\ | ||
| 2951 | The Edebug package uses this to regain control."); | ||
| 2952 | Vsignal_hook_function = Qnil; | ||
| 2953 | |||
| 2926 | Qmocklisp_arguments = intern ("mocklisp-arguments"); | 2954 | Qmocklisp_arguments = intern ("mocklisp-arguments"); |
| 2927 | staticpro (&Qmocklisp_arguments); | 2955 | staticpro (&Qmocklisp_arguments); |
| 2928 | DEFVAR_LISP ("mocklisp-arguments", &Vmocklisp_arguments, | 2956 | DEFVAR_LISP ("mocklisp-arguments", &Vmocklisp_arguments, |
| 2929 | "While in a mocklisp function, the list of its unevaluated args."); | 2957 | "While in a mocklisp function, the list of its unevaluated args."); |
| 2930 | Vmocklisp_arguments = Qt; | 2958 | Vmocklisp_arguments = Qt; |
| 2931 | 2959 | ||
| 2960 | DEFVAR_LISP ("debug-force", &Vdebug_force, | ||
| 2961 | "*Non-nil means call the debugger regardless of condition handlers.\n\ | ||
| 2962 | Note that `debug-on-error', `debug-on-quit' and friends\n\ | ||
| 2963 | still determine whether to handle the particular condition."); | ||
| 2964 | Vdebug_force = Qnil; | ||
| 2965 | |||
| 2932 | Vrun_hooks = intern ("run-hooks"); | 2966 | Vrun_hooks = intern ("run-hooks"); |
| 2933 | staticpro (&Vrun_hooks); | 2967 | staticpro (&Vrun_hooks); |
| 2934 | 2968 | ||