Mercurial > hg > xemacs-beta
comparison src/eval.c @ 163:0132846995bd r20-3b8
Import from CVS: tag r20-3b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:43:35 +0200 |
parents | 25f70ba0133c |
children | 5a88923fcbfe |
comparison
equal
deleted
inserted
replaced
162:4de2936b4e77 | 163:0132846995bd |
---|---|
145 Lisp_Object Vstack_trace_on_error; | 145 Lisp_Object Vstack_trace_on_error; |
146 | 146 |
147 /* List of conditions (non-nil atom means all) which enter the debugger | 147 /* List of conditions (non-nil atom means all) which enter the debugger |
148 if an error is handled by the command loop's error handler. */ | 148 if an error is handled by the command loop's error handler. */ |
149 Lisp_Object Vdebug_on_error; | 149 Lisp_Object Vdebug_on_error; |
150 | |
151 /* List of conditions and regexps specifying error messages which | |
152 do not enter the debugger even if Vdebug_on_error says they should. */ | |
153 Lisp_Object Vdebug_ignored_errors; | |
150 | 154 |
151 /* List of conditions (non-nil atom means all) which cause a backtrace | 155 /* List of conditions (non-nil atom means all) which cause a backtrace |
152 if any error is signalled. */ | 156 if any error is signalled. */ |
153 Lisp_Object Vstack_trace_on_signal; | 157 Lisp_Object Vstack_trace_on_signal; |
154 | 158 |
466 conditions = XCDR (conditions); | 470 conditions = XCDR (conditions); |
467 } | 471 } |
468 return 0; | 472 return 0; |
469 } | 473 } |
470 | 474 |
475 | |
476 /* Return 1 if an error with condition-symbols CONDITIONS, | |
477 and described by SIGNAL-DATA, should skip the debugger | |
478 according to debugger-ignore-errors. */ | |
479 | |
480 extern Lisp_Object Frunning_temacs_p(); | |
481 | |
482 static int | |
483 skip_debugger (Lisp_Object conditions, Lisp_Object data) | |
484 { | |
485 Lisp_Object tail; | |
486 int first_string = 1; | |
487 Lisp_Object error_message; | |
488 | |
489 if (!NILP(Frunning_temacs_p()) || NILP(Vdebug_ignored_errors)) | |
490 { | |
491 return 1; | |
492 } | |
493 | |
494 for (tail = Vdebug_ignored_errors; CONSP (tail); tail = XCDR (tail)) | |
495 { | |
496 if (STRINGP (XCAR (tail))) | |
497 { | |
498 if (first_string) | |
499 { | |
500 /* error_message = Ferror_message_string (data);*/ | |
501 error_message = build_string("Tell_Hrvoje"); | |
502 first_string = 0; | |
503 } | |
504 if (fast_lisp_string_match (XCAR (tail), error_message) >= 0) | |
505 return 1; | |
506 } | |
507 else | |
508 { | |
509 Lisp_Object contail; | |
510 | |
511 for (contail = conditions; CONSP (contail); contail = XCDR (contail)) | |
512 if (EQ (XCAR (tail), XCAR (contail))) | |
513 return 1; | |
514 } | |
515 } | |
516 | |
517 return 0; | |
518 } | |
519 | |
471 /* Actually generate a backtrace on STREAM. */ | 520 /* Actually generate a backtrace on STREAM. */ |
472 | 521 |
473 static Lisp_Object | 522 static Lisp_Object |
474 backtrace_259 (Lisp_Object stream) | 523 backtrace_259 (Lisp_Object stream) |
475 { | 524 { |
513 { | 562 { |
514 /* This function can GC */ | 563 /* This function can GC */ |
515 Lisp_Object val = Qunbound; | 564 Lisp_Object val = Qunbound; |
516 Lisp_Object all_handlers = Vcondition_handlers; | 565 Lisp_Object all_handlers = Vcondition_handlers; |
517 int speccount = specpdl_depth_counter; | 566 int speccount = specpdl_depth_counter; |
567 int skip_debugger_for_error = 0; | |
518 struct gcpro gcpro1; | 568 struct gcpro gcpro1; |
519 GCPRO1 (all_handlers); | 569 GCPRO1 (all_handlers); |
520 | 570 |
521 Vcondition_handlers = active_handlers; | 571 Vcondition_handlers = active_handlers; |
522 | 572 |
523 if (!entering_debugger && !*stack_trace_displayed && !signal_vars_only | 573 skip_debugger_for_error = skip_debugger (conditions, Fcons (sig, data)); |
574 | |
575 if (!entering_debugger && !*stack_trace_displayed && !signal_vars_only | |
576 && !skip_debugger_for_error | |
524 && wants_debugger (Vstack_trace_on_error, conditions)) | 577 && wants_debugger (Vstack_trace_on_error, conditions)) |
525 { | 578 { |
526 specbind (Qdebug_on_error, Qnil); | 579 specbind (Qdebug_on_error, Qnil); |
527 specbind (Qstack_trace_on_error, Qnil); | 580 specbind (Qstack_trace_on_error, Qnil); |
528 specbind (Qdebug_on_signal, Qnil); | 581 specbind (Qdebug_on_signal, Qnil); |
535 unbind_to (speccount, Qnil); | 588 unbind_to (speccount, Qnil); |
536 *stack_trace_displayed = 1; | 589 *stack_trace_displayed = 1; |
537 } | 590 } |
538 | 591 |
539 if (!entering_debugger && !*debugger_entered && !signal_vars_only | 592 if (!entering_debugger && !*debugger_entered && !signal_vars_only |
593 && !skip_debugger_for_error | |
540 && (EQ (sig, Qquit) | 594 && (EQ (sig, Qquit) |
541 ? debug_on_quit | 595 ? debug_on_quit |
542 : wants_debugger (Vdebug_on_error, conditions))) | 596 : wants_debugger (Vdebug_on_error, conditions))) |
543 { | 597 { |
544 debug_on_quit &= ~2; /* reset critical bit */ | 598 debug_on_quit &= ~2; /* reset critical bit */ |
5157 if one of its condition symbols appears in the list. | 5211 if one of its condition symbols appears in the list. |
5158 See also variable `stack-trace-on-error'. | 5212 See also variable `stack-trace-on-error'. |
5159 */ ); | 5213 */ ); |
5160 Vstack_trace_on_signal = Qnil; | 5214 Vstack_trace_on_signal = Qnil; |
5161 | 5215 |
5216 DEFVAR_LISP ("debug-ignored-errors", &Vdebug_ignored_errors /* | |
5217 *List of errors for which the debugger should not be called. | |
5218 Each element may be a condition-name or a regexp that matches error messages. | |
5219 If any element applies to a given error, that error skips the debugger | |
5220 and just returns to top level. | |
5221 This overrides the variable `debug-on-error'. | |
5222 It does not apply to errors handled by `condition-case'. | |
5223 */ ); | |
5224 Vdebug_ignored_errors = Qnil; | |
5225 | |
5162 DEFVAR_LISP ("debug-on-error", &Vdebug_on_error /* | 5226 DEFVAR_LISP ("debug-on-error", &Vdebug_on_error /* |
5163 *Non-nil means enter debugger if an unhandled error is signalled. | 5227 *Non-nil means enter debugger if an unhandled error is signalled. |
5164 The debugger will not be entered if the error is handled by | 5228 The debugger will not be entered if the error is handled by |
5165 a `condition-case'. | 5229 a `condition-case'. |
5166 If the value is a list, an error only means to enter the debugger | 5230 If the value is a list, an error only means to enter the debugger |