2009-11-28
2009-11-28 13:36:21 by Martin Stjernholm <mast@lysator.liu.se>
-
613c34a2c5e96cefdeb574d525c0851f2655d6bd
(40 lines)
(+26/-14)
[
Show
| Annotate
]
Branch: 7.9
More rtldebug to get better info when gc_mark problems happen.
Rev: Makefile:1.168
Rev: src/array.c:1.226
Rev: src/gc.c:1.338
Rev: src/gc.h:1.138
Rev: src/mapping.c:1.214
Rev: src/multiset.c:1.119
Rev: src/object.c:1.304
Rev: src/pike_types.c:1.361
Rev: src/program.c:1.773
Rev: src/svalue.c:1.255
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.337 2009/11/28 11:49:47 mast Exp $
+ || $Id: gc.c,v 1.338 2009/11/28 13:36:20 mast Exp $
*/
#include "global.h"
993:
#endif /* PIKE_DEBUG */
- static void debug_gc_fatal_va (void *a, int flags,
+ static void debug_gc_fatal_va (void *a, int type, int flags,
const char *fmt, va_list args)
{
#ifdef PIKE_DEBUG
1005: Inside #if defined(PIKE_DEBUG)
#ifdef PIKE_DEBUG
if (a) {
+ void *inblock;
/* Temporarily jumping out of gc to avoid being caught in debug
* checks in describe(). */
Pike_in_gc = 0;
- describe(a);
+ if (type == PIKE_T_UNKNOWN)
+ type = attempt_to_identify (a, &inblock);
+ describe_something (a, type, 0, 0, 0, inblock);
if (flags & 1) locate_references(a);
Pike_in_gc = orig_gc_pass;
}
1027:
{
va_list args;
va_start (args, fmt);
- debug_gc_fatal_va (a, flags, fmt, args);
+ debug_gc_fatal_va (a, PIKE_T_UNKNOWN, flags, fmt, args);
va_end (args);
}
-
+ void debug_gc_fatal_2 (void *a, int type, int flags, const char *fmt, ...)
+ {
+ va_list args;
+ va_start (args, fmt);
+ debug_gc_fatal_va (a, type, flags, fmt, args);
+ va_end (args);
+ }
+
static void dloc_gc_fatal (const char *file, int line,
void *a, int flags, const char *fmt, ...)
{
va_list args;
fprintf (stderr, "%s:%d: GC fatal:\n", file, line);
va_start (args, fmt);
- debug_gc_fatal_va (a, flags, fmt, args);
+ debug_gc_fatal_va (a, PIKE_T_UNKNOWN, flags, fmt, args);
va_end (args);
}
2459:
m->flags |= GC_GOT_DEAD_REF;
}
- int gc_mark(void *a)
+ int gc_mark_func(void *a DO_IF_DEBUG (COMMA int type))
{
struct marker *m;
#ifdef PIKE_DEBUG
if (Pike_in_gc == GC_PASS_ZAP_WEAK && !find_marker (a))
- gc_fatal (a, 0, "gc_mark() called for for thing without marker "
+ gc_fatal_2 (a, type, 0, "gc_mark() called for for thing without marker "
"in zap weak pass.\n");
#endif
2483: Inside #if defined(PIKE_DEBUG)
if (Pike_in_gc != GC_PASS_MARK && Pike_in_gc != GC_PASS_ZAP_WEAK)
Pike_fatal("GC mark attempted in invalid pass.\n");
if (!*(INT32 *) a)
- gc_fatal(a, 0, "Marked a thing without refs.\n");
+ gc_fatal_2 (a, type, 1, "Marked a thing without refs.\n");
if (m->weak_refs < 0)
- gc_fatal(a, 0, "Marked a thing scheduled for weak free.\n");
+ gc_fatal_2 (a, type, 1, "Marked a thing scheduled for weak free.\n");
#endif
if (Pike_in_gc == GC_PASS_ZAP_WEAK) {
2495: Inside #if defined(PIKE_DEBUG)
* internal cyclic nonweak refs. */
#ifdef PIKE_DEBUG
if (!(m->flags & GC_MARKED))
- gc_fatal(a, 0, "gc_mark() called for thing in zap weak pass "
+ gc_fatal_2 (a, type, 0, "gc_mark() called for thing in zap weak pass "
"that wasn't marked before.\n");
#endif
if (m->flags & GC_FREE_VISITED) {
2513: Inside #if defined(PIKE_DEBUG)
debug_malloc_touch (a);
#ifdef PIKE_DEBUG
if (m->weak_refs != 0)
- gc_fatal (a, 0, "weak_refs changed in marker "
+ gc_fatal_2 (a, type, 0, "weak_refs changed in marker "
"already visited by gc_mark().\n");
#endif
return 0;