* files for more information.
*/
-/*
- * $Header$
- */
-
#include <stdio.h>
#include <stdarg.h>
+#include <stdlib.h>
+#include "sbcl.h"
#include "arch.h"
#include "signal.h"
#include "runtime.h"
-#include "sbcl.h"
#include "interr.h"
#include "print.h"
#include "lispregs.h"
+#include "genesis/static-symbols.h"
+#include "genesis/vector.h"
+#include "thread.h"
\f
/* the way that we shut down the system on a fatal error */
lossage_handler = handler;
}
-void
+never_returns
lose(char *fmt, ...)
{
va_list ap;
- fprintf(stderr, "fatal error encountered in SBCL runtime system");
+ fprintf(stderr, "fatal error encountered in SBCL pid %d",getpid());
+ /* freeze all the other threads, so we have a chance of debugging them
+ */
+ if(all_threads) {
+ struct thread *th1,*th=arch_os_get_current_thread();
+ for_each_thread(th1) {
+ if(th1!=th) kill(th1->pid,SIGSTOP);
+ }
+ }
+
if (fmt) {
fprintf(stderr, ":\n");
va_start(ap, fmt);
fprintf(stderr, "\n");
fflush(stderr);
lossage_handler();
+ fprintf(stderr, "Argh! lossage_handler() returned, total confusion..\n");
+ exit(1);
}
\f
/* internal error handler for when the Lisp error system doesn't exist
brief_print(*os_context_register_addr(context, offset));
break;
- case sc_BaseCharReg:
+ case sc_CharacterReg:
ch = *os_context_register_addr(context, offset);
-#ifdef __i386__
+#ifdef LISP_FEATURE_X86
if (offset&1)
ch = ch>>8;
ch = ch & 0xff;
#ifdef sc_WordPointerReg
case sc_WordPointerReg:
#endif
- printf("\t0x%08x\n", *os_context_register_addr(context, offset));
+ printf("\t0x%08lx\n", (unsigned long) *os_context_register_addr(context, offset));
break;
case sc_SignedReg:
- printf("\t%d\n", *os_context_register_addr(context, offset));
+ printf("\t%ld\n", (long) *os_context_register_addr(context, offset));
break;
case sc_UnsignedReg:
- printf("\t%u\n", *os_context_register_addr(context, offset));
+ printf("\t%lu\n", (unsigned long) *os_context_register_addr(context, offset));
break;
#ifdef sc_SingleFloatReg
case sc_SingleFloatReg:
lispobj debug_print(lispobj string)
{
- fprintf(stderr, "%s\n", (char *)(((struct vector *)PTR(string))->data));
+ /* 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.. */
+ fprintf(stderr, "%s\n",
+ (char *)(((struct vector *)native_pointer(string))->data),untouched);
return NIL;
}