Branch: Tag:

2000-04-13

2000-04-13 02:11:25 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

more debug..

Rev: src/gc.c:1.56
Rev: src/program.c:1.224

29:      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.55 2000/04/13 00:50:16 hubbe Exp $"); + RCSID("$Id: gc.c,v 1.56 2000/04/13 02:11:25 hubbe Exp $");      /* Run garbage collect approximate every time we have    * 20 percent of all arrays, objects and programs is
129: Inside #if defined(PIKE_DEBUG)
  static int found_in_type=0;   void *gc_svalue_location=0;    + #ifdef PIKE_DEBUG + static char *fatal_after_gc=0; + #endif +  +    void describe_location(void *memblock, int type, void *location)   {    struct program *p;
539: Inside #if defined(PIKE_DEBUG)
      if(check_for == (void *)1 && gc_do_free(a))    { -  fprintf(stderr,"Reference to object to free in referenced object!\n"); +  struct marker *m=get_marker(a); +  fprintf(stderr,"**Reference to object to free in referenced object!\n"); +  fprintf(stderr," has %ld references, while gc() found %ld + %ld external.\n",(long)*(INT32 *)a,(long)m->refs,(long)m->xrefs);    describe(a);    locate_references(a); -  fatal("Reference to object to free in referenced object!\n"); -  return 0; +  fprintf(stderr,"##### Continuing search for more bugs....\n"); +  fatal_after_gc="Reference to object to free in referenced object!\n";    }    return 0;    }
699: Inside #if defined(PIKE_DEBUG)
      return 1;    } +  +  if(check_for == (void *)1 && gc_do_free(a)) +  { +  struct marker *m=get_marker(a); +  fprintf(stderr,"EXTERNAL Reference to object to free%s!\n",in?in:""); +  fprintf(stderr," has %ld references, while gc() found %ld + %ld external.\n",(long)*(INT32 *)a,(long)m->refs,(long)m->xrefs); +  if(where) describe_location(0,T_UNKNOWN,where); +  describe(a); +  locate_references(a); +  fprintf(stderr,"##### Continuing search for more bugs....\n"); +  fatal_after_gc="EXTERNAL Reference to object to free.\n"; +  } +     return 0;    }    m=get_marker(a);
772: Inside #if defined(PIKE_DEBUG)
   fprintf(stderr,"Garbage collecting ... ");    if(num_objects < 0)    fatal("Panic, less than zero objects!\n"); -  -  +    #endif       last_gc=TIME(0);
829:    gc_free_all_unreferenced_objects();      #ifdef PIKE_DEBUG +     check_for=0; -  +  if(fatal_after_gc) fatal(fatal_after_gc);   #endif       exit_gc();