diff --git a/src/interpreter.h b/src/interpreter.h index 3f566f0d4efb2fa9c4751299fb60dd3d22a39cc7..087010127535688bccffd86549bc1f3dbfb27457 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -76,8 +76,21 @@ static int eval_instruction(unsigned char *pc) backlog[backlogp].pc=pc; debug_malloc_touch(fp->current_object); - if(d_flag>1) - check_object(fp->current_object); + switch(d_flag) + { + default: + case 3: + check_object(fp->current_object); + break; + + case 2: + check_object_context(fp->current_object, + fp->context.prog, + fp->current_storage); + case 1: + case 0: + break; + } } if(t_flag > 2) diff --git a/src/object.c b/src/object.c index 7ba03ce0b7689c35ed5feec5b1a4f8c47fb63a00..6cbfa436bc30468368e54894d3a22016ccc2d2ac 100644 --- a/src/object.c +++ b/src/object.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: object.c,v 1.78 1999/09/14 19:38:48 hubbe Exp $"); +RCSID("$Id: object.c,v 1.79 1999/09/14 22:51:04 hubbe Exp $"); #include "object.h" #include "dynamic_buffer.h" #include "interpret.h" @@ -1411,6 +1411,35 @@ void exit_object(void) } #ifdef PIKE_DEBUG +void check_object_context(struct object *o, + struct program *context_prog, + char *current_storage) +{ + int q; + if(o == fake_object) return; + + for(q=0;q<(int)context_prog->num_variable_index;q++) + { + int d=context_prog->variable_index[q]; + if(d<0 || d>=context_prog->num_identifiers) + fatal("Illegal index in variable_index!\n"); + + if(context_prog->identifiers[d].run_time_type == T_MIXED) + { + struct svalue *s; + s=(struct svalue *)(current_storage + + context_prog->identifiers[d].func.offset); + check_svalue(s); + }else{ + union anything *u; + u=(union anything *)(current_storage + + context_prog->identifiers[d].func.offset); + check_short_svalue(u, + context_prog->identifiers[d].run_time_type); + } + } +} + void check_object(struct object *o) { int e; @@ -1418,39 +1447,15 @@ void check_object(struct object *o) debug_malloc_touch(o); if(o == fake_object) return; - - p=o->prog; - PUSH_FRAME(o); + if(!(p=o->prog)) return; /* clear globals and call C initializers */ for(e=p->num_inherits-1; e>=0; e--) { - int q; - SET_FRAME_CONTEXT(p->inherits[e]); - - for(q=0;q<(int)pike_frame->context.prog->num_variable_index;q++) - { - int d=pike_frame->context.prog->variable_index[q]; - if(d<0 || d>=pike_frame->context.prog->num_identifiers) - fatal("Illegal index in variable_index!\n"); - - if(pike_frame->context.prog->identifiers[d].run_time_type == T_MIXED) - { - struct svalue *s; - s=(struct svalue *)(pike_frame->current_storage + - pike_frame->context.prog->identifiers[d].func.offset); - check_svalue(s); - }else{ - union anything *u; - u=(union anything *)(pike_frame->current_storage + - pike_frame->context.prog->identifiers[d].func.offset); - check_short_svalue(u, - pike_frame->context.prog->identifiers[d].run_time_type); - } - } + check_object_context(o, + p->inherits[e].prog, + o->storage + p->inherits[e].storage_offset); } - - POP_FRAME(); } void check_all_objects(void) diff --git a/src/object.h b/src/object.h index daa737ce20427ec6a47550fe16e30f7d48ccb988..c33bc9b3e68fe5d0929b30ccd019fe263df9d754 100644 --- a/src/object.h +++ b/src/object.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: object.h,v 1.27 1999/09/14 19:38:50 hubbe Exp $ + * $Id: object.h,v 1.28 1999/09/14 22:51:05 hubbe Exp $ */ #ifndef OBJECT_H #define OBJECT_H @@ -97,6 +97,7 @@ void init_object(void); void exit_object(void); void check_object(struct object *o); void check_all_objects(void); +void check_context(struct object *o, struct program *p, char *storage); /* Prototypes end here */ #ifdef MALLOC_DEBUG