2003-08-20
2003-08-20 16:43:57 by Martin Stjernholm <mast@lysator.liu.se>
-
60c15a1d98c9398be6107c17a761d6baa8163c7d
(39 lines)
(+34/-5)
[
Show
| Annotate
]
Branch: 7.9
Print more debug in the extra refs fatal. Fixed attempt_to_identify to
handle types and callables.
Rev: src/gc.c:1.225
Rev: src/gc.h:1.103
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: gc.c,v 1.224 2003/08/20 12:00:03 grubba Exp $
+ || $Id: gc.c,v 1.225 2003/08/20 16:43:57 mast Exp $
*/
#include "global.h"
33:
#include "block_alloc.h"
- RCSID("$Id: gc.c,v 1.224 2003/08/20 12:00:03 grubba Exp $");
+ RCSID("$Id: gc.c,v 1.225 2003/08/20 16:43:57 mast Exp $");
int gc_enabled = 1;
262:
static int gc_is_watching = 0;
- int attempt_to_identify(void *something, void **inblock)
+ TYPE_T attempt_to_identify(void *something, void **inblock)
{
-
+ size_t i;
struct array *a;
struct object *o;
struct program *p;
struct mapping *m;
struct multiset *mu;
-
+ struct pike_type *t;
+ struct callable *c;
if (inblock) *inblock = 0;
311:
if(safe_debug_findstring((struct pike_string *)something))
return T_STRING;
+ for (i = 0; i < pike_type_hash_size; i++)
+ for (t = pike_type_hash[i]; t; t = t->next)
+ if (t == (struct pike_type *) something)
+ return T_TYPE;
+
+ for (c = first_callable; c; c = c->next)
+ if (c == (struct callable *) something)
+ return T_STRUCT_CALLABLE;
+
return PIKE_T_UNKNOWN;
}
851: Inside #if defined(PIKE_DEBUG)
p=id_to_program(((struct object *)a)->program_id);
}
if (p) {
- fprintf(stderr,"%*s**Describing program of object:\n",indent,"");
+ fprintf(stderr,"%*s**Describing program %p of object:\n",indent,"", p);
#ifdef DEBUG_MALLOC
if ((int) p == 0x55555555)
fprintf(stderr, "%*s**Zapped program pointer.\n", indent, "");
2895:
GC_VERBOSE_DO(fprintf(stderr, "| posttouch: %u things\n", n));
}
#ifdef PIKE_DEBUG
- if (gc_extra_refs)
+ if (gc_extra_refs) {
+ size_t e;
+ struct marker *m;
+ fprintf (stderr, "Lost track of %d extra refs to things in gc.\n"
+ "Searching for marker(s) with extra refs:\n", gc_extra_refs);
+ for (e = 0; e < marker_hash_table_size; e++)
+ while ((m = marker_hash_table[e]))
+ if (m->flags & GC_GOT_EXTRA_REF) {
+ fprintf (stderr, "========================================\n"
+ "Found marker with extra ref: ");
+ describe_marker (m);
+ fprintf (stderr, "Describing the thing pointed to:\n");
+ describe (m->data);
+ }
+ fprintf (stderr, "========================================\n"
+ "Done searching for marker(s) with extra refs.\n");
Pike_fatal("Lost track of %d extra refs to things in gc.\n", gc_extra_refs);
-
+ }
if(fatal_after_gc) Pike_fatal("%s", fatal_after_gc);
#endif