Skip to content
Snippets Groups Projects
Commit a6ee7caf authored by wlott's avatar wlott
Browse files

Added a boolean to enable calling into lisp to handle internal errors. If

said boolean is not set, just call the signal handler instead of
INTERNAL-ERROR.
parent c0dd91a4
No related branches found
No related tags found
No related merge requests found
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/interrupt.c,v 1.16 1990/11/27 10:05:06 wlott Exp $ */ /* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/interrupt.c,v 1.17 1990/11/28 17:14:26 wlott Exp $ */
/* Interrupt handing magic. */ /* Interrupt handing magic. */
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#define crap_out(msg) do { write(2, msg, sizeof(msg)); abort(); } while (0) #define crap_out(msg) do { write(2, msg, sizeof(msg)); abort(); } while (0)
boolean internal_errors_enabled = 0;
struct sigcontext *lisp_interrupt_contexts[MAX_INTERRUPTS]; struct sigcontext *lisp_interrupt_contexts[MAX_INTERRUPTS];
union interrupt_handler interrupt_handlers[NSIG]; union interrupt_handler interrupt_handlers[NSIG];
...@@ -122,12 +124,17 @@ struct sigcontext *context; ...@@ -122,12 +124,17 @@ struct sigcontext *context;
handler = interrupt_handlers[signal]; handler = interrupt_handlers[signal];
were_in_lisp = !foreign_function_call_active; were_in_lisp = !foreign_function_call_active;
if (handler.c == SIG_DFL || handler.c == SIG_IGN)
/* This can happen if someone tries to ignore or default on of the */
/* signals we need for runtime support. */
return;
if (were_in_lisp) if (were_in_lisp)
fake_foreign_function_call(context); fake_foreign_function_call(context);
/* Allow signals again. */ /* Allow signals again. */
sigsetmask(context->sc_mask); sigsetmask(context->sc_mask);
if (LowtagOf(handler.lisp) == type_EvenFixnum || if (LowtagOf(handler.lisp) == type_EvenFixnum ||
LowtagOf(handler.lisp) == type_OddFixnum) LowtagOf(handler.lisp) == type_OddFixnum)
(*handler.c)(signal, code, context); (*handler.c)(signal, code, context);
...@@ -246,26 +253,36 @@ struct sigcontext *context; ...@@ -246,26 +253,36 @@ struct sigcontext *context;
crap_out("%primitive halt called; the party is over.\n"); crap_out("%primitive halt called; the party is over.\n");
case trap_Error: case trap_Error:
sigsetmask(context->sc_mask); if (internal_errors_enabled) {
fake_foreign_function_call(context); sigsetmask(context->sc_mask);
args = current_control_stack_pointer; fake_foreign_function_call(context);
current_control_stack_pointer += 2; args = current_control_stack_pointer;
args[0] = alloc_sap(context); current_control_stack_pointer += 2;
args[1] = NIL; args[0] = alloc_sap(context);
call_into_lisp(INTERNAL_ERROR,SymbolFunction(INTERNAL_ERROR),args,2); args[1] = NIL;
undo_fake_foreign_function_call(context); call_into_lisp(INTERNAL_ERROR, SymbolFunction(INTERNAL_ERROR),
args, 2);
undo_fake_foreign_function_call(context);
}
else
handle_now(signal, code, context);
break; break;
case trap_Cerror: case trap_Cerror:
sigsetmask(context->sc_mask); if (internal_errors_enabled) {
fake_foreign_function_call(context); sigsetmask(context->sc_mask);
args = current_control_stack_pointer; fake_foreign_function_call(context);
current_control_stack_pointer += 2; args = current_control_stack_pointer;
args[0] = alloc_sap(context); current_control_stack_pointer += 2;
args[1] = T; args[0] = alloc_sap(context);
call_into_lisp(INTERNAL_ERROR,SymbolFunction(INTERNAL_ERROR),args,2); args[1] = T;
undo_fake_foreign_function_call(context); call_into_lisp(INTERNAL_ERROR, SymbolFunction(INTERNAL_ERROR),
skip_instruction(context); args, 2);
undo_fake_foreign_function_call(context);
skip_instruction(context);
}
else
handle_now(signal, code, context);
break; break;
default: default:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment