X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Finterr.c;h=5f7869c4bbe7552ff1d54e5664a325d715856632;hb=07ab1e4811ab16f95a9a5e8d767426a0787f22c0;hp=f693d8472bb79b4dca6a038293b1a1bdcf9fb6a0;hpb=79cc569a97e444389350ea3f5b1017374fe16bec;p=sbcl.git diff --git a/src/runtime/interr.c b/src/runtime/interr.c index f693d84..5f7869c 100644 --- a/src/runtime/interr.c +++ b/src/runtime/interr.c @@ -28,6 +28,7 @@ #include "genesis/static-symbols.h" #include "genesis/vector.h" #include "thread.h" +#include "monitor.h" /* the way that we shut down the system on a fatal error */ @@ -37,19 +38,23 @@ default_lossage_handler(void) exit(1); } static void (*lossage_handler)(void) = default_lossage_handler; -void -set_lossage_handler(void handler(void)) + +void enable_lossage_handler(void) { - lossage_handler = handler; + lossage_handler = monitor_or_something; +} +void disable_lossage_handler(void) +{ + lossage_handler = default_lossage_handler; } -never_returns +void lose(char *fmt, ...) { va_list ap; fprintf(stderr, "fatal error encountered in SBCL pid %d",getpid()); #if defined(LISP_FEATURE_SB_THREAD) - fprintf(stderr, "(tid %ld)",thread_self()); + fprintf(stderr, "(tid %lu)", (unsigned long) thread_self()); #endif if (fmt) { fprintf(stderr, ":\n"); @@ -161,14 +166,17 @@ lispobj debug_print(lispobj string) { /* This is a kludge. It's not actually safe - in general - to use %primitive print on the alpha, because it skips half of the - number stack setup that should usually be done on a function call, - so the called routine (i.e. this one) ends up being able to overwrite - local variables in the caller. Rather than fix this everywhere - that %primitive print is used (it's only a debugging aid anyway) - we just put guarantee our safety by putting an unused buffer on - the stack before doing anything else here */ - char untouched[32]; /* GCC warns about not using this, but that's the point.. */ + number stack setup that should usually be done on a function + call, so the called routine (i.e. this one) ends up being able + to overwrite local variables in the caller. Rather than fix + this everywhere that %primitive print is used (it's only a + debugging aid anyway) we just guarantee our safety by putting + an unused buffer on the stack before doing anything else + here */ + char untouched[32]; fprintf(stderr, "%s\n", - (char *)(((struct vector *)native_pointer(string))->data),untouched); + (char *)(((struct vector *)native_pointer(string))->data)); + /* shut GCC up about not using this, because that's the point.. */ + (void)untouched; return NIL; }