From 0ad1d39850b0c434c6dc1fc5f3726c6bb5a41c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Tue, 15 Feb 2000 03:33:47 +0100 Subject: [PATCH] Added some more DEBUG_MALLOC checks. Rev: src/interpreter.h:1.31 --- src/interpreter.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/interpreter.h b/src/interpreter.h index 9736ce7f17..d10d3830fc 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -194,11 +194,13 @@ static int eval_instruction(unsigned char *pc) /* The not so basic 'push value' instructions */ CASE(F_GLOBAL); - low_object_index_no_free(sp, - fp->current_object, - GET_ARG() + fp->context.identifier_level); - sp++; - print_return_value(); + { + low_object_index_no_free(sp, + fp->current_object, + GET_ARG() + fp->context.identifier_level); + sp++; + print_return_value(); + } break; CASE(F_EXTERNAL); @@ -247,9 +249,31 @@ static int eval_instruction(unsigned char *pc) if(!(p=o->prog)) error("Attempting to access variable in destructed object\n"); + +#ifdef DEBUG_MALLOC + if (p->refs == 0x55555555) { + fprintf(stderr, "The program %p has been zapped!\n", p); + debug_malloc_dump_references(p); + fprintf(stderr, "Which taken from the object %p\n", o); + debug_malloc_dump_references(o); + fatal("Looks like the program %p has been zapped!\n", p); + } +#endif /* DEBUG_MALLOC */ inherit=INHERIT_FROM_INT(p, i); +#ifdef DEBUG_MALLOC + if (inherit->storage_offset == 0x55555555) { + fprintf(stderr, "The inherit %p has been zapped!\n", inherit); + debug_malloc_dump_references(inherit); + fprintf(stderr, "It was extracted from the program %p %d\n", p, i); + debug_malloc_dump_references(p); + fprintf(stderr, "Which was in turn taken from the object %p\n", o); + debug_malloc_dump_references(o); + fatal("Looks like the program %p has been zapped!\n", p); + } +#endif /* DEBUG_MALLOC */ + if(!accumulator) break; --accumulator; } -- GitLab