pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:142: Inside #if defined(DEBUG)
      return T_UNKNOWN;   }      static void *check_for =0;   static char *found_where="";   static void *found_in=0;   static TYPE_T found_in_type=0;   void *gc_svalue_location=0;    + void describe_location(void *memblock, TYPE_T type, void *location) + { +  fprintf(stderr,"**Location of (short) svalue: %p\n",location); +  if(type==T_OBJECT) +  { +  struct object *o=(struct object *)memblock; +  if(o->prog) +  { +  INT32 e,d; +  for(e=0;e<o->prog->num_inherits;e++) +  { +  struct inherit tmp=o->prog->inherits[e]; +  char *base=o->storage + tmp.storage_offset; +  +  for(d=0;d<tmp.prog->num_identifiers;d++) +  { +  struct identifier *id=tmp.prog->identifiers+d; +  if(!IDENTIFIER_IS_VARIABLE(id->identifier_flags)) continue; +  +  if(location == (void *)(base + id->func.offset)) +  { +  fprintf(stderr,"**In variable %s\n",id->name->str); +  } +  } +  } +  } +  return; +  } +  +  if(type == T_ARRAY) +  { +  struct array *a=(struct array *)memblock; +  struct svalue *s=(struct svalue *)location; +  fprintf(stderr,"**In index %ld\n",(long)(s-ITEM(a))); +  return; +  } + } +    static void gdb_gc_stop_here(void *a)   {    fprintf(stderr,"**One ref found%s.\n",found_where); -  fprintf(stderr,"**Location of (short) svalue: %p\n",gc_svalue_location); +     describe_something(found_in, found_in_type); -  +  describe_location(found_in, found_in_type, gc_svalue_location);   }      TYPE_FIELD debug_gc_check_svalues(struct svalue *s, int num, TYPE_T t, void *data)   {    TYPE_FIELD ret;    found_in=data;    found_in_type=t;    ret=gc_check_svalues(s,num);    found_in_type=T_UNKNOWN;    return ret;
pike.git/src/gc.c:187: Inside #if defined(DEBUG)
   case T_OBJECT:    p=((struct object *)a)->prog;    if(!p)    {    fprintf(stderr,"**The object is destructed.\n");    break;    }    fprintf(stderr,"**Attempting to describe program object was instantiated from:\n");       case T_PROGRAM: +  { +  char *tmp; +  INT32 line,pos; +  +  fprintf(stderr,"**Program id: %ld\n",(long)(p->id));    if(!p->num_linenumbers)    {    fprintf(stderr,"**The program was written in C.\n");    break;    } -  if(p->linenumbers[0]==127) +  +  for(pos=0;pos<(long)p->program_size && pos<100;pos++)    { -  fprintf(stderr,"**The program may have been compiled from %s.\n",p->linenumbers+1); +  tmp=get_line(p->program+pos, p, &line); +  if(tmp && line) +  { +  fprintf(stderr,"**Location: %s:%ld\n",tmp,(long)line);    break;    } -  fprintf(stderr,"**No information available about this program.\n"); +  }    break; -  +  }       case T_ARRAY:    fprintf(stderr,"**Describing array:\n");    debug_dump_array((struct array *)a);    break;    }   }      #endif   
pike.git/src/gc.c:236:    struct marker *m;    m=getmark(a);   #ifdef DEBUG    if(m->refs + m->xrefs > *(INT32 *)a)    {    INT32 refs=m->refs;    INT32 xrefs=m->xrefs;    TYPE_T t=attempt_to_identify(a);       fprintf(stderr,"**Something has %ld references, while gc() found %ld + %ld external.\n",(long)*(INT32 *)a,(long)refs,(long)xrefs); -  describe_something(t, a); +  describe_something(a, t);       fprintf(stderr,"**Looking for references:\n");    check_for=a;       found_where=" in an array";    gc_check_all_arrays();       found_where=" in a multiset";    gc_check_all_multisets();