2 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interr.c,v 1.10 2009/06/11 16:04:01 rtoy Rel $
4 * Stuff to handle internal errors.
16 #include "internals.h"
22 /* Lossage handler. */
25 default_lossage_handler(void)
30 static void (*lossage_handler) (void) = default_lossage_handler;
33 set_lossage_handler(void handler(void))
35 lossage_handler = handler;
45 vfprintf(stderr, fmt, ap);
53 /* Internal error handler for when the Lisp error system doesn't exist. */
55 static char *errors[] = ERRORS;
58 internal_error(os_context_t * context)
60 unsigned char *ptr = arch_internal_error_arguments(context);
61 int len, scoffset, sc, offset, ch;
64 printf("Error: %s\n", errors[*ptr++]);
69 if (scoffset == 253) {
72 } else if (scoffset == 254) {
73 scoffset = ptr[0] + ptr[1] * 256;
76 } else if (scoffset == 255) {
77 scoffset = ptr[0] + (ptr[1] << 8) + (ptr[2] << 16) + (ptr[3] << 24);
82 offset = scoffset >> 5;
84 printf(" SC: %d, Offset: %d", sc, offset);
87 case sc_DescriptorReg:
89 brief_print(SC_REG(context, offset));
93 ch = SC_REG(context, offset);
113 if (ch < 32 || ch > 127)
114 printf("\\%03o", ch);
116 printf("\t'%c'\n", ch);
121 #ifdef sc_WordPointerReg
122 case sc_WordPointerReg:
124 printf("\t0x%08lx\n", SC_REG(context, offset));
127 printf("\t%ld\n", SC_REG(context, offset));
130 printf("\t%lu\n", SC_REG(context, offset));
135 printf("\t%g\n", *(float *) &context->sc_fpregs[offset]);
140 printf("\t%g\n", *(double *) &context->sc_fpregs[offset]);
145 printf("\t%Lg\n", *(long double *) &context->sc_fpregs[offset]);
161 /* Utility routines used by random pieces of code. */
164 debug_print(lispobj object)
168 printf("%s\n", (char *) (((struct vector *) PTR(object))->data));
171 if (Pointerp(object)) {
172 struct vector *lisp_string = (struct vector*) PTR(object);
174 if ((unsigned long) lisp_string->header == type_SimpleString) {
175 unsigned short int* lisp_chars;
178 len = lisp_string->length >> 2;
179 lisp_chars = (unsigned short int*) lisp_string->data;
182 * Do we really want to dump out the entire contents of
183 * the utf-16 string? Should we just print out the low 8
184 * bits of each Lisp character? Or maybe convert the
185 * utf-16 string to some more suitable encoding?
187 fwrite(lisp_chars, sizeof(*lisp_chars), len, stdout);
196 printf("obj @0x%lx: ", (unsigned long) object);