pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:132: Inside #if defined(DEBUG)
   fprintf(stderr,"Second since last gc() : %ld\n", (long)TIME(0) - (long)last_gc);    fprintf(stderr,"Projected garbage : %f\n", objects_freed * (double) num_allocs / (double) alloc_threshold);    fprintf(stderr,"in_gc : %d\n", in_gc);   }      TYPE_T attempt_to_identify(void *something)   {    struct array *a;    struct object *o;    struct program *p; +  struct mapping *m; +  struct multiset *mu;       a=&empty_array;    do    {    if(a==(struct array *)something) return T_ARRAY;    a=a->next;    }while(a!=&empty_array);       for(o=first_object;o;o=o->next)    if(o==(struct object *)something)    return T_OBJECT;       for(p=first_program;p;p=p->next)    if(p==(struct program *)something)    return T_PROGRAM;    -  +  for(m=first_mapping;m;m=m->next) +  if(m==(struct program *)something) +  return T_MAPPING; +  +  for(m=first_mapping;m;m=m->next) +  if(m==(struct mapping *)something) +  return T_MAPPING; +  +  for(mu=first_multiset;mu;mu=mu->next) +  if(mu==(struct multiset *)something) +  return T_MULTISET; +  +  if(safe_debug_findstring((struct pike_string *)something)) +  return T_STRING; +     return T_UNKNOWN;   }      static void *check_for =0;   static char *found_where="";   static void *found_in=0;   static int found_in_type=0;   void *gc_svalue_location=0;      void describe_location(void *memblock, TYPE_T type, void *location)   {    if(!location) return;    fprintf(stderr,"**Location of (short) svalue: %p\n",location); -  if(type==T_OBJECT) +  +  switch(type)    { -  +  case T_OBJECT: +  {    struct object *o=(struct object *)memblock;    if(o->prog)    {    INT32 e,d;    for(e=0;e<(INT32)o->prog->num_inherits;e++)    {    struct inherit tmp=o->prog->inherits[e];    char *base=o->storage + tmp.storage_offset;       for(d=0;d<(INT32)tmp.prog->num_identifiers;d++)
pike.git/src/gc.c:187: Inside #if defined(DEBUG)
   if(location == (void *)(base + id->func.offset))    {    fprintf(stderr,"**In variable %s\n",id->name->str);    }    }    }    }    return;    }    -  if(type == T_ARRAY) +  case 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);    describe_something(found_in, found_in_type);    describe_location(found_in, found_in_type, gc_svalue_location);   }      void debug_gc_xmark_svalues(struct svalue *s, int num, char *fromwhere)   {
pike.git/src/gc.c:285: Inside #if defined(DEBUG)
   break;    }    }    break;    }       case T_ARRAY:    fprintf(stderr,"**Describing array:\n");    debug_dump_array((struct array *)a);    break; +  +  case T_STRING: +  { +  struct pike_string *s=(struct pike_string *)a; +  fprintf(stderr,"**String length is %d:\n",s->len); +  if(s->len>77) +  { +  fprintf(stderr,"** \"%60s ...\"\n",s->str); +  }else{ +  fprintf(stderr,"** \"%s\"\n",s->str);    } -  +  break;    } -  +  } + }      #endif      INT32 gc_check(void *a)   {   #ifdef DEBUG    if(check_for)    {    if(check_for == a)    {