comparison src/eval.c @ 16355:1d85b2698564

(Vdebug_force): New variable. (syms_of_eval): Set up Lisp var. (find_handler_clause): If Vdebug_force, call debugger even if there are handlers.
author Richard M. Stallman <rms@gnu.org>
date Fri, 27 Sep 1996 20:39:38 +0000
parents 584310941e70
children 0128b923d281
comparison
equal deleted inserted replaced
16354:b8f9fd9e47fa 16355:1d85b2698564
132 Lisp_Object Vdebug_on_error; 132 Lisp_Object Vdebug_on_error;
133 133
134 /* List of conditions and regexps specifying error messages which 134 /* List of conditions and regexps specifying error messages which
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
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;
137 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;
141 147
1209 1215
1210 #ifdef HAVE_WINDOW_SYSTEM 1216 #ifdef HAVE_WINDOW_SYSTEM
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)
1217 { 1227 {
1218 register Lisp_Object clause; 1228 register Lisp_Object clause;
1333 register Lisp_Object h; 1343 register Lisp_Object h;
1334 register Lisp_Object tem; 1344 register Lisp_Object tem;
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
1339 { 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. */
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)
1343 ? debug_on_quit 1360 ? debug_on_quit
1344 : wants_debugger (Vdebug_on_error, conditions)) 1361 : wants_debugger (Vdebug_on_error, conditions))
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;
1355 } 1371 }
1356 return Qt; 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;
1378 }
1357 } 1379 }
1358 for (h = handlers; CONSP (h); h = Fcdr (h)) 1380 for (h = handlers; CONSP (h); h = Fcdr (h))
1359 { 1381 {
1360 Lisp_Object handler, condit; 1382 Lisp_Object handler, condit;
1361 1383
2921 If due to error, args are `error' and a list of the args to `signal'.\n\ 2943 If due to error, args are `error' and a list of the args to `signal'.\n\
2922 If due to `apply' or `funcall' entry, one arg, `lambda'.\n\ 2944 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;
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;
2931 2965
2932 Vrun_hooks = intern ("run-hooks"); 2966 Vrun_hooks = intern ("run-hooks");
2933 staticpro (&Vrun_hooks); 2967 staticpro (&Vrun_hooks);
2934 2968
2935 staticpro (&Vautoload_queue); 2969 staticpro (&Vautoload_queue);