Branch: Tag:

2004-02-09

2004-02-09 22:02:56 by Martin Stjernholm <mast@lysator.liu.se>

More dmalloc paranoia. Fixed a debug check which could cause false alarms.

Rev: src/interpret.c:1.343

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret.c,v 1.342 2003/12/09 15:39:45 grubba Exp $ + || $Id: interpret.c,v 1.343 2004/02/09 22:02:56 mast Exp $   */      #include "global.h" - RCSID("$Id: interpret.c,v 1.342 2003/12/09 15:39:45 grubba Exp $"); + RCSID("$Id: interpret.c,v 1.343 2004/02/09 22:02:56 mast Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"
542:   PMOD_EXPORT void find_external_context(struct external_variable_context *loc,    int depth)   { -  struct program *p = loc->o->prog; +  struct program *p;       TRACE((4, "-find_external_context(%d, inherit=%ld)\n", depth,    DO_NOT_WARN((long)(loc->o->prog ? loc->inherit - loc->o->prog->inherits : 0))));
552:    Pike_fatal("No object\n");   #endif    +  p = loc->o->prog; +  + #ifdef DEBUG_MALLOC +  if (loc->o->refs == 0x55555555) { +  fprintf(stderr, "The object %p has been zapped!\n", loc->o); +  describe(p); +  Pike_fatal("Object zapping detected.\n"); +  } +  if (p && p->refs == 0x55555555) { +  fprintf(stderr, "The program %p has been zapped!\n", p); +  describe(p); +  fprintf(stderr, "Which taken from the object %p\n", loc->o); +  describe(loc->o); +  Pike_fatal("Looks like the program %p has been zapped!\n", p); +  } + #endif /* DEBUG_MALLOC */ +     while(--depth>=0)    {    struct inherit *inh = loc->inherit;
639:    }   #endif /* DEBUG_MALLOC */    +  if (p) {   #ifdef PIKE_DEBUG    if(loc->parent_identifier < 0 || -  (p && loc->parent_identifier > p->num_identifier_references)) +  loc->parent_identifier > p->num_identifier_references)    Pike_fatal("Identifier out of range, loc->parent_identifer=%d!\n",    loc->parent_identifier);   #endif -  -  if (p) +     loc->inherit=INHERIT_FROM_INT(p, loc->parent_identifier); -  +  }    else    /* Return a valid pointer to a dummy inherit for the convenience    * of the caller. Identifier offsets will be bogus but it'll