X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fbacktrace.c;h=09179c7831ce7df5dbeb61005993aa8669fe0ab6;hb=70227794f1eefb567c13ec04f7bd6d3b6794aa29;hp=ae5f1f9621fb15a1eed9bab94f0ace78fe3e38a8;hpb=2378b4fe567a8fea78b1e4915b9497d8c18ca92f;p=sbcl.git diff --git a/src/runtime/backtrace.c b/src/runtime/backtrace.c index ae5f1f9..09179c7 100644 --- a/src/runtime/backtrace.c +++ b/src/runtime/backtrace.c @@ -15,8 +15,8 @@ #include #include -#include "runtime.h" #include "sbcl.h" +#include "runtime.h" #include "globals.h" #include "os.h" #include "interrupt.h" @@ -28,30 +28,30 @@ #include "genesis/primitive-objects.h" #include "thread.h" -#ifndef __i386__ +#if !(defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) /* KLUDGE: Sigh ... I know what the call frame looks like and it had * better not change. */ struct call_frame { -#ifndef alpha - struct call_frame *old_cont; +#ifndef LISP_FEATURE_ALPHA + struct call_frame *old_cont; #else u32 old_cont; #endif - lispobj saved_lra; + lispobj saved_lra; lispobj code; - lispobj other_state[5]; + lispobj other_state[5]; }; struct call_info { -#ifndef alpha +#ifndef LISP_FEATURE_ALPHA struct call_frame *frame; #else u32 frame; #endif int interrupted; -#ifndef alpha +#ifndef LISP_FEATURE_ALPHA struct code *code; #else u32 code; @@ -79,7 +79,6 @@ code_pointer(lispobj object) break; case RETURN_PC_HEADER_WIDETAG: case SIMPLE_FUN_HEADER_WIDETAG: - case CLOSURE_FUN_HEADER_WIDETAG: len = HEADER_LENGTH(header); if (len == 0) headerp = NULL; @@ -98,7 +97,7 @@ cs_valid_pointer_p(struct call_frame *pointer) { struct thread *thread=arch_os_get_current_thread(); return (((char *) thread->control_stack_start <= (char *) pointer) && - ((char *) pointer < (char *) current_control_stack_pointer)); + ((char *) pointer < (char *) current_control_stack_pointer)); } static void @@ -120,27 +119,27 @@ call_info_from_context(struct call_info *info, os_context_t *context) info->interrupted = 1; if (lowtag_of(*os_context_register_addr(context, reg_CODE)) - == FUN_POINTER_LOWTAG) { + == FUN_POINTER_LOWTAG) { /* We tried to call a function, but crapped out before $CODE could * be fixed up. Probably an undefined function. */ info->frame = - (struct call_frame *)(*os_context_register_addr(context, - reg_OCFP)); + (struct call_frame *)(*os_context_register_addr(context, + reg_OCFP)); info->lra = (lispobj)(*os_context_register_addr(context, reg_LRA)); info->code = code_pointer(info->lra); pc = (unsigned long)native_pointer(info->lra); } else { info->frame = - (struct call_frame *)(*os_context_register_addr(context, reg_CFP)); + (struct call_frame *)(*os_context_register_addr(context, reg_CFP)); info->code = - code_pointer(*os_context_register_addr(context, reg_CODE)); + code_pointer(*os_context_register_addr(context, reg_CODE)); info->lra = NIL; pc = *os_context_pc_addr(context); } if (info->code != NULL) info->pc = pc - (unsigned long) info->code - -#ifndef alpha +#ifndef LISP_FEATURE_ALPHA (HEADER_LENGTH(info->code->header) * sizeof(lispobj)); #else (HEADER_LENGTH(((struct code *)info->code)->header) * sizeof(lispobj)); @@ -157,7 +156,7 @@ previous_info(struct call_info *info) int free; if (!cs_valid_pointer_p(info->frame)) { - printf("Bogus callee value (0x%08x).\n", (unsigned long)info->frame); + printf("Bogus callee value (0x%08lx).\n", (unsigned long)info->frame); return 0; } @@ -173,11 +172,11 @@ previous_info(struct call_info *info) /* We were interrupted. Find the correct signal context. */ free = SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,thread)>>2; while (free-- > 0) { - os_context_t *context = - thread->interrupt_contexts[free]; + os_context_t *context = + thread->interrupt_contexts[free]; if ((struct call_frame *)(*os_context_register_addr(context, - reg_CFP)) - == info->frame) { + reg_CFP)) + == info->frame) { call_info_from_context(info, context); break; } @@ -188,7 +187,7 @@ previous_info(struct call_info *info) if (info->code != NULL) info->pc = (unsigned long)native_pointer(info->lra) - (unsigned long)info->code - -#ifndef alpha +#ifndef LISP_FEATURE_ALPHA (HEADER_LENGTH(info->code->header) * sizeof(lispobj)); #else (HEADER_LENGTH(((struct code *)info->code)->header) * sizeof(lispobj)); @@ -204,19 +203,19 @@ void backtrace(int nframes) { struct call_info info; - + call_info_from_lisp_state(&info); do { - printf("entry_points; #else function = ((struct code *)info.code)->entry_points; @@ -245,6 +244,7 @@ backtrace(int nframes) string = (struct vector *) object; printf("%s, ", (char *) string->data); } else + /* FIXME: broken from (VECTOR NIL) */ printf("(Not simple string??\?), "); } else printf("(Not other pointer??\?), "); @@ -257,7 +257,7 @@ backtrace(int nframes) printf("CODE: ???, "); if (info.lra != NIL) - printf("LRA: 0x%08x, ", (unsigned long)info.lra); + printf("LRA: 0x%08lx, ", (unsigned long)info.lra); else printf(", ");