X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fmonitor.c;h=dd7808d7b70f5c869957f248401c541424c1c4b6;hb=78fa16bf55be44cc16845be84d98023e83fb14bc;hp=b494aaff22cc7db14b6cc4030301076a141337a3;hpb=c81c32ef8a737b0cc61d3c0c6a137cab39baac73;p=sbcl.git diff --git a/src/runtime/monitor.c b/src/runtime/monitor.c index b494aaf..dd7808d 100644 --- a/src/runtime/monitor.c +++ b/src/runtime/monitor.c @@ -18,8 +18,8 @@ #include #include -#include "runtime.h" #include "sbcl.h" +#include "runtime.h" /* Almost all of this file can be skipped if we're not supporting LDB. */ #if defined(LISP_FEATURE_SB_LDB) @@ -33,6 +33,11 @@ #include "globals.h" #include "lispregs.h" #include "interrupt.h" +#include "thread.h" +#include "genesis/static-symbols.h" +#include "genesis/primitive-objects.h" + + /* When we need to do command input, we use this stream, which is not * in general stdin, so that things will "work" (as well as being @@ -171,16 +176,17 @@ regs_cmd(char **ptr) { printf("CSP\t=\t0x%08lX\n", (unsigned long)current_control_stack_pointer); printf("FP\t=\t0x%08lX\n", (unsigned long)current_control_frame_pointer); -#if !defined(__i386__) +#if !(defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) printf("BSP\t=\t0x%08X\n", (unsigned long)current_binding_stack_pointer); #endif -#ifdef __i386__ +#if 0 +#if (defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) printf("BSP\t=\t0x%08lx\n", (unsigned long)SymbolValue(BINDING_STACK_POINTER)); #endif printf("DYNAMIC\t=\t0x%08lx\n", (unsigned long)DYNAMIC_SPACE_START); -#if defined(__i386__) +#if (defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) printf("ALLOC\t=\t0x%08lx\n", (unsigned long)SymbolValue(ALLOCATION_POINTER)); #else @@ -192,7 +198,7 @@ regs_cmd(char **ptr) (unsigned long)SymbolValue(STATIC_SPACE_FREE_POINTER)); printf("RDONLY\t=\t0x%08lx\n", (unsigned long)SymbolValue(READ_ONLY_SPACE_FREE_POINTER)); - +#endif /* 0 */ #ifdef MIPS printf("FLAGS\t=\t0x%08x\n", current_flags_register); #endif @@ -279,7 +285,7 @@ quit_cmd(char **ptr) fflush(stdout); fgets(buf, sizeof(buf), ldb_in); if (buf[0] == 'y' || buf[0] == 'Y' || buf[0] == '\n') - exit(0); + exit(1); } static void @@ -309,50 +315,55 @@ purify_cmd(char **ptr) static void print_context(os_context_t *context) { - int i; + int i; - for (i = 0; i < NREGS; i++) { - printf("%s:\t", lisp_register_names[i]); -#ifdef __i386__ - brief_print((lispobj)(*os_context_register_addr(context, - i*2))); + for (i = 0; i < NREGS; i++) { + printf("%s:\t", lisp_register_names[i]); +#ifdef LISP_FEATURE_X86 + brief_print((lispobj)(*os_context_register_addr(context, + i*2))); #else - brief_print((lispobj)(*os_context_register_addr(context,i))); + brief_print((lispobj)(*os_context_register_addr(context,i))); #endif - } - printf("PC:\t\t 0x%08lx\n", - (unsigned long)(*os_context_pc_addr(context))); + } +#ifdef LISP_FEATURE_DARWIN + printf("DAR:\t\t 0x%08lx\n", (unsigned long)(*os_context_register_addr(context, 41))); + printf("DSISR:\t\t 0x%08lx\n", (unsigned long)(*os_context_register_addr(context, 42))); +#endif + printf("PC:\t\t 0x%08lx\n", + (unsigned long)(*os_context_pc_addr(context))); } static void print_context_cmd(char **ptr) { - int free; + int free; + struct thread *thread=arch_os_get_current_thread(); - free = SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX)>>2; + free = SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,thread)>>2; - if (more_p(ptr)) { - int index; - - index = parse_number(ptr); - - if ((index >= 0) && (index < free)) { - printf("There are %d interrupt contexts.\n", free); - printf("printing context %d\n", index); - print_context(lisp_interrupt_contexts[index]); - } else { - printf("There aren't that many/few contexts.\n"); - printf("There are %d interrupt contexts.\n", free); - } + if (more_p(ptr)) { + int index; + + index = parse_number(ptr); + + if ((index >= 0) && (index < free)) { + printf("There are %d interrupt contexts.\n", free); + printf("printing context %d\n", index); + print_context(thread->interrupt_contexts[index]); } else { - if (free == 0) - printf("There are no interrupt contexts!\n"); - else { - printf("There are %d interrupt contexts.\n", free); - printf("printing context %d\n", free - 1); - print_context(lisp_interrupt_contexts[free - 1]); - } + printf("There aren't that many/few contexts.\n"); + printf("There are %d interrupt contexts.\n", free); + } + } else { + if (free == 0) + printf("There are no interrupt contexts!\n"); + else { + printf("There are %d interrupt contexts.\n", free); + printf("printing context %d\n", free - 1); + print_context(thread->interrupt_contexts[free - 1]); } + } } static void @@ -374,14 +385,15 @@ static void catchers_cmd(char **ptr) { struct catch_block *catch; + struct thread *thread=arch_os_get_current_thread(); - catch = (struct catch_block *)SymbolValue(CURRENT_CATCH_BLOCK); + catch = (struct catch_block *)SymbolValue(CURRENT_CATCH_BLOCK,thread); if (catch == NULL) printf("There are no active catchers!\n"); else { while (catch != NULL) { -#ifndef __i386__ +#if !(defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) printf("0x%08lX:\n\tuwp: 0x%08lX\n\tfp: 0x%08lX\n\tcode: 0x%08lx\n\tentry: 0x%08lx\n\ttag: ", (unsigned long)catch, (unsigned long)(catch->current_uwp), (unsigned long)(catch->current_cont), @@ -499,7 +511,11 @@ monitor_or_something() #if defined(LISP_FEATURE_SB_LDB) ldb_monitor(); #else - fprintf(stderr, "There's no LDB in this build; exiting.\n"); + fprintf(stderr, +"The system is too badly corrupted or confused to continue at the Lisp\n\ +level. If the system had been compiled with the SB-LDB feature, we'd drop\n\ +into the LDB low-level debugger now. But there's no LDB in this build, so\n\ +we can't really do anything but just exit, sorry.\n"); exit(1); #endif }