comparison src/eval.c @ 165:5a88923fcbfe r20-3b9

Import from CVS: tag r20-3b9
author cvs
date Mon, 13 Aug 2007 09:44:42 +0200
parents 0132846995bd
children 85ec50267440
comparison
equal deleted inserted replaced
164:4e0740e5aab2 165:5a88923fcbfe
475 475
476 /* Return 1 if an error with condition-symbols CONDITIONS, 476 /* Return 1 if an error with condition-symbols CONDITIONS,
477 and described by SIGNAL-DATA, should skip the debugger 477 and described by SIGNAL-DATA, should skip the debugger
478 according to debugger-ignore-errors. */ 478 according to debugger-ignore-errors. */
479 479
480 extern Lisp_Object Frunning_temacs_p(); 480 extern Lisp_Object Frunning_temacs_p(), Ferror_message_string(Lisp_Object obj);
481 481
482 static int 482 static int
483 skip_debugger (Lisp_Object conditions, Lisp_Object data) 483 skip_debugger (Lisp_Object conditions, Lisp_Object data)
484 { 484 {
485 Lisp_Object tail; 485 Lisp_Object tail;
486 int first_string = 1; 486 int first_string = 1;
487 Lisp_Object error_message; 487 Lisp_Object error_message;
488 488 #if 0
489 if (!NILP(Frunning_temacs_p()) || NILP(Vdebug_ignored_errors)) 489 struct gcpro gcpro1;
490 { 490 #endif
491 return 1; 491
492 } 492 /* Comment by Hrvoje Niksic:
493 For some reason, Ferror_message_string loses in temacs. This
494 should require some more consideration than this knee-jerk
495 solution, but it will do for now. For those interested in
496 debugging, here is what happens:
497
498 In temacs, a condition-cased file-error occurs. Now, we enter
499 signal_call_debugger, which is supposed to decide whether we
500 should call debugger (for example, if `debug-on-signal' requires
501 it). signal_call_debugger calls skip_debugger, which calls
502 Ferror_message_string. Ferror_message_string in turn calls
503 print_error_message. For some unfathomable reason, the
504 expression
505
506 errname = Fcar (data);
507
508 fails with a `wrong-type-argument' error, which should not
509 happen, as the DATA argument is the very same Lisp_Object
510 skip_debugger was called with (which is in signal_call_debugger,
511 and the DATA argument is Fcons (FOO, BAR)).
512
513 Of course, since an error is signaled, signal_call_debugger gets
514 called again, which calls skip_debugger, and we end up with a
515 beautiful endless recursion.
516
517 The only explanation I can think of is that DATA should be
518 gc-protected during the way; I cannot test this, as I cannot
519 repeat all of this. The crash info comes from Steve. */
520 #if 0
521 if (!NILP(Frunning_temacs_p()))
522 {
523 return 0;
524 }
525 #endif
526 #if 0
527 GCPRO1(data);
528 #endif
493 529
494 for (tail = Vdebug_ignored_errors; CONSP (tail); tail = XCDR (tail)) 530 for (tail = Vdebug_ignored_errors; CONSP (tail); tail = XCDR (tail))
495 { 531 {
496 if (STRINGP (XCAR (tail))) 532 if (STRINGP (XCAR (tail)))
497 { 533 {
498 if (first_string) 534 if (first_string)
499 { 535 {
500 /* error_message = Ferror_message_string (data);*/ 536 error_message = Ferror_message_string (data);
501 error_message = build_string("Tell_Hrvoje"); 537 /* error_message = build_string("Tell_Hrvoje"); */
502 first_string = 0; 538 first_string = 0;
503 } 539 }
504 if (fast_lisp_string_match (XCAR (tail), error_message) >= 0) 540 if (fast_lisp_string_match (XCAR (tail), error_message) >= 0) {
541 #if 0
542 UNGCPRO;
543 #endif
505 return 1; 544 return 1;
545 }
506 } 546 }
507 else 547 else
508 { 548 {
509 Lisp_Object contail; 549 Lisp_Object contail;
510 550
511 for (contail = conditions; CONSP (contail); contail = XCDR (contail)) 551 for (contail = conditions; CONSP (contail); contail = XCDR (contail))
512 if (EQ (XCAR (tail), XCAR (contail))) 552 if (EQ (XCAR (tail), XCAR (contail))) {
553 #if 0
554 UNGCPRO;
555 #endif
513 return 1; 556 return 1;
557 }
514 } 558 }
515 } 559 }
516 560
561 #if 0
562 UNGCPRO;
563 #endif
517 return 0; 564 return 0;
518 } 565 }
519 566
520 /* Actually generate a backtrace on STREAM. */ 567 /* Actually generate a backtrace on STREAM. */
521 568