From: Alastair Bridgewater Date: Sat, 12 Dec 2009 20:52:13 +0000 (+0000) Subject: 1.0.33.9: LDB stability improvements. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=b429c5c0557ed790e84dae4d6c35e06ab1a14416;p=sbcl.git 1.0.33.9: LDB stability improvements. * Make sure that a struct object is actually in the lisp heap space before attempting to access its memory. * We have a perfectly good is_lisp_pointer() function, use it in print_obj(). --- diff --git a/src/runtime/print.c b/src/runtime/print.c index a7a578c..f6b5ff0 100644 --- a/src/runtime/print.c +++ b/src/runtime/print.c @@ -244,8 +244,13 @@ static void print_list(lispobj obj) static void brief_struct(lispobj obj) { - printf("#", - (unsigned long) ((struct instance *)native_pointer(obj))->slots[0]); + struct instance *instance = (struct instance *)native_pointer(obj); + if (!is_valid_lisp_addr((os_vm_address_t)instance)) { + printf("(invalid address)"); + } else { + printf("#", + (unsigned long) instance->slots[0]); + } } static void print_struct(lispobj obj) @@ -253,10 +258,14 @@ static void print_struct(lispobj obj) struct instance *instance = (struct instance *)native_pointer(obj); unsigned int i; char buffer[16]; - print_obj("type: ", ((struct instance *)native_pointer(obj))->slots[0]); - for (i = 1; i < HeaderValue(instance->header); i++) { - sprintf(buffer, "slot %d: ", i); - print_obj(buffer, instance->slots[i]); + if (!is_valid_lisp_addr((os_vm_address_t)instance)) { + printf("(invalid address)"); + } else { + print_obj("type: ", ((struct instance *)native_pointer(obj))->slots[0]); + for (i = 1; i < HeaderValue(instance->header); i++) { + sprintf(buffer, "slot %d: ", i); + print_obj(buffer, instance->slots[i]); + } } } @@ -630,11 +639,7 @@ static void print_obj(char *prefix, lispobj obj) if (var != NULL && var_clock(var) == cur_clock) dont_descend = 1; - if (var == NULL && - ((obj & LOWTAG_MASK) == FUN_POINTER_LOWTAG || - (obj & LOWTAG_MASK) == LIST_POINTER_LOWTAG || - (obj & LOWTAG_MASK) == INSTANCE_POINTER_LOWTAG || - (obj & LOWTAG_MASK) == OTHER_POINTER_LOWTAG)) + if (var == NULL && is_lisp_pointer(obj)) var = define_var(NULL, obj, 0); if (var != NULL) diff --git a/version.lisp-expr b/version.lisp-expr index b22953d..90938a4 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.33.8" +"1.0.33.9"