pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/      #include "global.h"    - #ifdef GC2 -  +    struct callback *gc_evaluator_callback=0;      #include "array.h"   #include "multiset.h"   #include "mapping.h"   #include "object.h"   #include "program.h"   #include "stralloc.h"   #include "stuff.h"   #include "error.h"
pike.git/src/gc.c:156: Inside #if defined(DEBUG)
   for(p=first_program;p;p=p->next)    if(p==(struct program *)something)    return T_PROGRAM;       return T_UNKNOWN;   }      static void *check_for =0;   static char *found_where="";   static void *found_in=0; - static TYPE_T found_in_type=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)    {    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];
pike.git/src/gc.c:199: Inside #if defined(DEBUG)
   {    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,"***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) + { +  found_in=(void *)fromwhere; +  found_in_type=-1; +  gc_xmark_svalues(s,num); +  found_in_type=T_UNKNOWN; +  found_in=0; + } +    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; -  +  found_in=0;    return ret;   }      void debug_gc_check_short_svalue(union anything *u, TYPE_T type, TYPE_T t, void *data)   {    found_in=data;    found_in_type=t;    gc_check_short_svalue(u,type);    found_in_type=T_UNKNOWN; -  +  found_in=0;   }    - void describe_something(void *a, TYPE_T t) + void describe_something(void *a, int t)   {    struct program *p=(struct program *)a;    if(!a) return; -  +  if(t==-1) +  { +  fprintf(stderr,"**Location description: %s\n",(char *)a); +  return; +  } +     fprintf(stderr,"**Location: %p Type: %s Refs: %d\n",a,    get_name_of_type(t),    *(INT32 *)a);       switch(t)    {    case T_OBJECT:    p=((struct object *)a)->prog;    if(!p)    {
pike.git/src/gc.c:537:   #endif      #ifdef ALWAYS_GC    ADD_GC_CALLBACK();   #else    if(d_flag > 3) ADD_GC_CALLBACK();   #endif    in_gc=0;   }    - #endif +