Back to index

plt-scheme  4.2.1
Classes | Defines | Functions | Variables
dbg_mlc.c File Reference
#include <errno.h>
#include <string.h>
#include "private/dbg_mlc.h"

Go to the source code of this file.

Classes

struct  closure

Defines

#define CROSSES_HBLK(p, sz)   (((word)(p + sizeof(oh) + sz - 1) ^ (word)p) >= HBLKSIZE)
#define MAX_SMASHED   20
#define RA

Functions

void GC_default_print_heap_obj_proc ()
GC_API void
GC_register_finalizer_no_order 
GC_PROTO ((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd, GC_finalization_proc *ofn, GC_PTR *ocd))
GC_bool GC_has_other_debug_info (ptr_t p)
ptr_t GC_store_debug_info (ptr_t p, word sz, GC_CONST char *string, word integer)
ptr_t GC_check_annotated_obj (oh *ohdr)
void GC_register_describe_type_fn (int kind, GC_describe_type_fn fn)
void GC_print_type (ptr_t p)
void GC_print_obj (ptr_t p)
void GC_debug_print_heap_obj_proc (ptr_t p)
void GC_print_smashed_obj (ptr_t p, ptr_t clobbered_addr)
void GC_check_heap_proc GC_PROTO ((void))
void GC_do_nothing ()
void GC_start_debugging ()
void GC_debug_register_displacement (GC_word offset)
GC_PTR GC_debug_malloc (size_t lb, char *s, int i)
GC_PTR GC_debug_malloc_ignore_off_page (size_t lb, char *s, int i)
GC_PTR GC_debug_malloc_atomic_ignore_off_page (size_t lb, char *s, int i)
GC_PTR GC_debug_malloc_stubborn (size_t lb, char *s, int i)
void GC_debug_change_stubborn (GC_PTR p)
void GC_debug_end_stubborn_change (GC_PTR p)
GC_PTR GC_debug_malloc_atomic (size_t lb, char *s, int i)
char * GC_debug_strdup (char *str, char *s, int i)
GC_PTR GC_debug_malloc_uncollectable (size_t lb, char *s, int i)
void GC_debug_free (GC_PTR p)
GC_PTR GC_debug_realloc (GC_PTR p, size_t lb, char *s, int i)
void GC_add_smashed (ptr_t smashed)
void GC_print_all_smashed_proc ()
void GC_check_heap_block (struct hblk *hbp, word dummy)
void GC_check_heap_proc ()
GC_PTR GC_make_closure (GC_finalization_proc fn, GC_PTR data)
void GC_debug_invoke_finalizer (char *obj, char *data)
static void store_old (GC_PTR obj, GC_finalization_proc my_old_fn, struct closure *my_old_cd, GC_finalization_proc *ofn, GC_PTR *ocd)
void GC_debug_register_finalizer (GC_PTR obj, GC_finalization_proc fn, GC_PTR cd, GC_finalization_proc *ofn, GC_PTR *ocd)
void GC_debug_register_finalizer_no_order (GC_PTR obj, GC_finalization_proc fn, GC_PTR cd, GC_finalization_proc *ofn, GC_PTR *ocd)
void GC_debug_register_finalizer_ignore_self (GC_PTR obj, GC_finalization_proc fn, GC_PTR cd, GC_finalization_proc *ofn, GC_PTR *ocd)
GC_PTR GC_debug_malloc_replacement (size_t lb)
GC_PTR GC_debug_realloc_replacement (GC_PTR p, size_t lb)

Variables

static GC_describe_type_fn GC_describe_type_fns [MAXOBJKINDS] = {0}
size_t GC_debug_header_size = sizeof(oh)
ptr_t GC_smashed [MAX_SMASHED]
unsigned GC_n_smashed = 0

Class Documentation

struct closure

Definition at line 1029 of file dbg_mlc.c.

Class Members
GC_PTR cl_data
GC_finalization_proc cl_fn

Define Documentation

#define CROSSES_HBLK (   p,
  sz 
)    (((word)(p + sizeof(oh) + sz - 1) ^ (word)p) >= HBLKSIZE)

Definition at line 238 of file dbg_mlc.c.

#define MAX_SMASHED   20

Definition at line 943 of file dbg_mlc.c.

#define RA

Definition at line 1193 of file dbg_mlc.c.


Function Documentation

void GC_add_smashed ( ptr_t  smashed)

Definition at line 950 of file dbg_mlc.c.

{
    GC_ASSERT(GC_is_marked(GC_base(smashed)));
    GC_smashed[GC_n_smashed] = smashed;
    if (GC_n_smashed < MAX_SMASHED - 1) ++GC_n_smashed;
      /* In case of overflow, we keep the first MAX_SMASHED-1  */
      /* entries plus the last one.                            */
    GC_have_errors = TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 313 of file dbg_mlc.c.

{
    register ptr_t body = (ptr_t)(ohdr + 1);
    register word gc_sz = GC_size((ptr_t)ohdr);
    if (ohdr -> oh_sz + DEBUG_BYTES > gc_sz) {
        return((ptr_t)(&(ohdr -> oh_sz)));
    }
    if (ohdr -> oh_sf != (START_FLAG ^ (word)body)) {
        return((ptr_t)(&(ohdr -> oh_sf)));
    }
    if (((word *)ohdr)[BYTES_TO_WORDS(gc_sz)-1] != (END_FLAG ^ (word)body)) {
        return((ptr_t)((word *)ohdr + BYTES_TO_WORDS(gc_sz)-1));
    }
    if (((word *)body)[SIMPLE_ROUNDED_UP_WORDS(ohdr -> oh_sz)]
        != (END_FLAG ^ (word)body)) {
        return((ptr_t)((word *)body + SIMPLE_ROUNDED_UP_WORDS(ohdr -> oh_sz)));
    }
    return(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GC_check_heap_block ( struct hblk hbp,
word  dummy 
)

Definition at line 982 of file dbg_mlc.c.

{
    register struct hblkhdr * hhdr = HDR(hbp);
    register word sz = hhdr -> hb_sz;
    register int word_no;
    register word *p, *plim;
    
    p = (word *)(hbp->hb_body);
    word_no = 0;
    if (sz > MAXOBJSZ) {
       plim = p;
    } else {
       plim = (word *)((((word)hbp) + HBLKSIZE) - WORDS_TO_BYTES(sz));
    }
    /* go through all words in block */
       while( p <= plim ) {
           if( mark_bit_from_hdr(hhdr, word_no)
               && GC_HAS_DEBUG_INFO((ptr_t)p)) {
               ptr_t clobbered = GC_check_annotated_obj((oh *)p);
               
               if (clobbered != 0) GC_add_smashed(clobbered);
           }
           word_no += sz;
           p += sz;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1015 of file dbg_mlc.c.

{
#   ifndef SMALL_CONFIG
#     ifdef ALIGN_DOUBLE
        GC_STATIC_ASSERT((sizeof(oh) & (2 * sizeof(word) - 1)) == 0);
#     else
        GC_STATIC_ASSERT((sizeof(oh) & (sizeof(word) - 1)) == 0);
#     endif
#   endif
    GC_apply_to_all_blocks(GC_check_heap_block, (word)0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 681 of file dbg_mlc.c.

{
}

Here is the caller graph for this function:

Definition at line 686 of file dbg_mlc.c.

{
}

Here is the caller graph for this function:

Definition at line 795 of file dbg_mlc.c.

{
    register GC_PTR base;
    register ptr_t clobbered;
    
    if (0 == p) return;
    base = GC_base(p);
    if (base == 0) {
        GC_err_printf1("Attempt to free invalid pointer %lx\n",
                     (unsigned long)p);
        ABORT("free(invalid pointer)");
    }
    if ((ptr_t)p - (ptr_t)base != sizeof(oh)) {
        GC_err_printf1(
                "GC_debug_free called on pointer %lx wo debugging info\n",
                (unsigned long)p);
    } else {
#     ifndef SHORT_DBG_HDRS
        clobbered = GC_check_annotated_obj((oh *)base);
        if (clobbered != 0) {
          if (((oh *)base) -> oh_sz == GC_size(base)) {
            GC_err_printf0(
                  "GC_debug_free: found previously deallocated (?) object at ");
          } else {
            GC_err_printf0("GC_debug_free: found smashed location at ");
          }
          GC_print_smashed_obj(p, clobbered);
        }
        /* Invalidate size */
        ((oh *)base) -> oh_sz = GC_size(base);
#     endif /* SHORT_DBG_HDRS */
    }
    if (GC_find_leak) {
        GC_free(base);
    } else {
       register hdr * hhdr = HDR(p);
       GC_bool uncollectable = FALSE;

        if (hhdr ->  hb_obj_kind == UNCOLLECTABLE) {
           uncollectable = TRUE;
       }
#      ifdef ATOMIC_UNCOLLECTABLE
           if (hhdr ->  hb_obj_kind == AUNCOLLECTABLE) {
                  uncollectable = TRUE;
           }
#      endif
       if (uncollectable) {
           GC_free(base);
       } else {
           size_t i;
           size_t obj_sz = hhdr -> hb_sz - BYTES_TO_WORDS(sizeof(oh));

           for (i = 0; i < obj_sz; ++i) ((word *)p)[i] = 0xdeadbeef;
           GC_ASSERT((word *)p + i == (word *)base + hhdr -> hb_sz);
       }
    } /* !GC_find_leak */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GC_debug_invoke_finalizer ( char *  obj,
char *  data 
)

Definition at line 1058 of file dbg_mlc.c.

{
    register struct closure * cl = (struct closure *) data;
    
    (*(cl -> cl_fn))((GC_PTR)((char *)obj + sizeof(oh)), cl -> cl_data);
} 

Here is the caller graph for this function:

GC_PTR GC_debug_malloc ( size_t  lb,
char *  s,
int  i 
)

Definition at line 483 of file dbg_mlc.c.

{
    GC_PTR result = GC_malloc(lb + DEBUG_BYTES);
    
    if (result == 0) {
        GC_err_printf1("GC_debug_malloc(%ld) returning NIL (",
                     (unsigned long) lb);
        GC_err_puts(s);
        GC_err_printf1(":%ld)\n", (unsigned long)i);
        return(0);
    }
    if (!GC_debugging_started) {
       GC_start_debugging();
    }
    ADD_CALL_CHAIN(result, ra);
    return (GC_store_debug_info(result, (word)lb, s, (word)i));
}

Here is the call graph for this function:

Here is the caller graph for this function:

GC_PTR GC_debug_malloc_atomic ( size_t  lb,
char *  s,
int  i 
)

Definition at line 696 of file dbg_mlc.c.

{
    GC_PTR result = GC_malloc_atomic(lb + DEBUG_BYTES);
    
    if (result == 0) {
        GC_err_printf1("GC_debug_malloc_atomic(%ld) returning NIL (",
                    (unsigned long) lb);
        GC_err_puts(s);
        GC_err_printf1(":%ld)\n", (unsigned long)i);
        return(0);
    }
    if (!GC_debugging_started) {
        GC_start_debugging();
    }
    ADD_CALL_CHAIN(result, ra);
    return (GC_store_debug_info(result, (word)lb, s, (word)i));
}

Here is the call graph for this function:

Here is the caller graph for this function:

GC_PTR GC_debug_malloc_atomic_ignore_off_page ( size_t  lb,
char *  s,
int  i 
)

Definition at line 539 of file dbg_mlc.c.

{
    GC_PTR result = GC_malloc_atomic_ignore_off_page(lb + DEBUG_BYTES);
    
    if (result == 0) {
        GC_err_printf1("GC_debug_malloc_atomic_ignore_off_page(%ld)"
                     " returning NIL (", (unsigned long) lb);
        GC_err_puts(s);
        GC_err_printf1(":%ld)\n", (unsigned long)i);
        return(0);
    }
    if (!GC_debugging_started) {
       GC_start_debugging();
    }
    ADD_CALL_CHAIN(result, ra);
    return (GC_store_debug_info(result, (word)lb, s, (word)i));
}

Here is the call graph for this function:

GC_PTR GC_debug_malloc_ignore_off_page ( size_t  lb,
char *  s,
int  i 
)

Definition at line 511 of file dbg_mlc.c.

{
    GC_PTR result = GC_malloc_ignore_off_page(lb + DEBUG_BYTES);
    
    if (result == 0) {
        GC_err_printf1("GC_debug_malloc_ignore_off_page(%ld) returning NIL (",
                     (unsigned long) lb);
        GC_err_puts(s);
        GC_err_printf1(":%ld)\n", (unsigned long)i);
        return(0);
    }
    if (!GC_debugging_started) {
       GC_start_debugging();
    }
    ADD_CALL_CHAIN(result, ra);
    return (GC_store_debug_info(result, (word)lb, s, (word)i));
}

Here is the call graph for this function:

Definition at line 1196 of file dbg_mlc.c.

{
    return GC_debug_malloc(lb, RA "unknown", 0);
}

Here is the call graph for this function:

GC_PTR GC_debug_malloc_stubborn ( size_t  lb,
char *  s,
int  i 
)

Definition at line 672 of file dbg_mlc.c.

{
    return GC_debug_malloc(lb, OPT_RA s, i);
}

Here is the call graph for this function:

Here is the caller graph for this function:

GC_PTR GC_debug_malloc_uncollectable ( size_t  lb,
char *  s,
int  i 
)

Definition at line 741 of file dbg_mlc.c.

{
    GC_PTR result = GC_malloc_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES);
    
    if (result == 0) {
        GC_err_printf1("GC_debug_malloc_uncollectable(%ld) returning NIL (",
                    (unsigned long) lb);
        GC_err_puts(s);
        GC_err_printf1(":%ld)\n", (unsigned long)i);
        return(0);
    }
    if (!GC_debugging_started) {
        GC_start_debugging();
    }
    ADD_CALL_CHAIN(result, ra);
    return (GC_store_debug_info(result, (word)lb, s, (word)i));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 409 of file dbg_mlc.c.

Here is the call graph for this function:

Here is the caller graph for this function:

GC_PTR GC_debug_realloc ( GC_PTR  p,
size_t  lb,
char *  s,
int  i 
)

Definition at line 869 of file dbg_mlc.c.

{
    register GC_PTR base = GC_base(p);
    register ptr_t clobbered;
    register GC_PTR result;
    register size_t copy_sz = lb;
    register size_t old_sz;
    register hdr * hhdr;
    
    if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
    if (base == 0) {
        GC_err_printf1(
              "Attempt to reallocate invalid pointer %lx\n", (unsigned long)p);
        ABORT("realloc(invalid pointer)");
    }
    if ((ptr_t)p - (ptr_t)base != sizeof(oh)) {
        GC_err_printf1(
              "GC_debug_realloc called on pointer %lx wo debugging info\n",
              (unsigned long)p);
        return(GC_realloc(p, lb));
    }
    hhdr = HDR(base);
    switch (hhdr -> hb_obj_kind) {
#    ifdef STUBBORN_ALLOC
      case STUBBORN:
        result = GC_debug_malloc_stubborn(lb, OPT_RA s, i);
        break;
#    endif
      case NORMAL:
        result = GC_debug_malloc(lb, OPT_RA s, i);
        break;
      case PTRFREE:
        result = GC_debug_malloc_atomic(lb, OPT_RA s, i);
        break;
      case UNCOLLECTABLE:
       result = GC_debug_malloc_uncollectable(lb, OPT_RA s, i);
       break;
#    ifdef ATOMIC_UNCOLLECTABLE
      case AUNCOLLECTABLE:
       result = GC_debug_malloc_atomic_uncollectable(lb, OPT_RA s, i);
       break;
#    endif
      default:
        GC_err_printf0("GC_debug_realloc: encountered bad kind\n");
        ABORT("bad kind");
    }
#   ifdef SHORT_DBG_HDRS
      old_sz = GC_size(base) - sizeof(oh);
#   else
      clobbered = GC_check_annotated_obj((oh *)base);
      if (clobbered != 0) {
        GC_err_printf0("GC_debug_realloc: found smashed location at ");
        GC_print_smashed_obj(p, clobbered);
      }
      old_sz = ((oh *)base) -> oh_sz;
#   endif
    if (old_sz < copy_sz) copy_sz = old_sz;
    if (result == 0) return(0);
    BCOPY(p, result,  copy_sz);
    GC_debug_free(p);
    return(result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

GC_PTR GC_debug_realloc_replacement ( GC_PTR  p,
size_t  lb 
)

Definition at line 1202 of file dbg_mlc.c.

{
    return GC_debug_realloc(p, lb, RA "unknown", 0);
}

Here is the call graph for this function:

Definition at line 472 of file dbg_mlc.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1096 of file dbg_mlc.c.

{
    GC_finalization_proc my_old_fn;
    GC_PTR my_old_cd;
    ptr_t base = GC_base(obj);
    if (0 == base) return;
    if ((ptr_t)obj - base != sizeof(oh)) {
        GC_err_printf1(
           "GC_debug_register_finalizer called with non-base-pointer 0x%lx\n",
           obj);
    }
    if (0 == fn) {
      GC_register_finalizer(base, 0, 0, &my_old_fn, &my_old_cd);
    } else {
      GC_register_finalizer(base, GC_debug_invoke_finalizer,
                         GC_make_closure(fn,cd), &my_old_fn, &my_old_cd);
    }
    store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd);
}

Here is the call graph for this function:

Definition at line 1163 of file dbg_mlc.c.

{
    GC_finalization_proc my_old_fn;
    GC_PTR my_old_cd;
    ptr_t base = GC_base(obj);
    if (0 == base) return;
    if ((ptr_t)obj - base != sizeof(oh)) {
        GC_err_printf1(
           "GC_debug_register_finalizer_ignore_self called with non-base-pointer 0x%lx\n",
           obj);
    }
    if (0 == fn) {
      GC_register_finalizer_ignore_self(base, 0, 0, &my_old_fn, &my_old_cd);
    } else {
      GC_register_finalizer_ignore_self(base, GC_debug_invoke_finalizer,
                                 GC_make_closure(fn,cd), &my_old_fn,
                                 &my_old_cd);
    }
    store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd);
}

Here is the call graph for this function:

Definition at line 1129 of file dbg_mlc.c.

{
    GC_finalization_proc my_old_fn;
    GC_PTR my_old_cd;
    ptr_t base = GC_base(obj);
    if (0 == base) return;
    if ((ptr_t)obj - base != sizeof(oh)) {
        GC_err_printf1(
         "GC_debug_register_finalizer_no_order called with non-base-pointer 0x%lx\n",
         obj);
    }
    if (0 == fn) {
      GC_register_finalizer_no_order(base, 0, 0, &my_old_fn, &my_old_cd);
    } else {
      GC_register_finalizer_no_order(base, GC_debug_invoke_finalizer,
                                 GC_make_closure(fn,cd), &my_old_fn,
                                 &my_old_cd);
    }
    store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd);
 }

Here is the call graph for this function:

char* GC_debug_strdup ( char *  str,
char *  s,
int  i 
)

Definition at line 721 of file dbg_mlc.c.

{
    char *copy;
    if (str == NULL) return NULL;
    copy = GC_debug_malloc_atomic(strlen(str) + 1, OPT_RA s, i);
    if (copy == NULL) {
      errno = ENOMEM;
      return NULL;
    }
    strcpy(copy, str);
    return copy;
}

Here is the call graph for this function:

Definition at line 451 of file dbg_mlc.c.

{}

Here is the caller graph for this function:

Definition at line 37 of file dbg_mlc.c.

{
    register oh * ohdr = (oh *)p;
    register ptr_t body = (ptr_t)(ohdr + 1);
    register word sz = GC_size((ptr_t) ohdr);
    
    if (HBLKPTR((ptr_t)ohdr) != HBLKPTR((ptr_t)body)
        || sz < DEBUG_BYTES + EXTRA_BYTES) {
        return(FALSE);
    }
    if (ohdr -> oh_sz == sz) {
       /* Object may have had debug info, but has been deallocated    */
       return(FALSE);
    }
    if (ohdr -> oh_sf == (START_FLAG ^ (word)body)) return(TRUE);
    if (((word *)ohdr)[BYTES_TO_WORDS(sz)-1] == (END_FLAG ^ (word)body)) {
        return(TRUE);
    }
    return(FALSE);
}

Here is the call graph for this function:

Definition at line 1037 of file dbg_mlc.c.

{
    struct closure * result =
#   ifdef DBG_HDRS_ALL
      (struct closure *) GC_debug_malloc(sizeof (struct closure),
                                     GC_EXTRAS);
#   else
      (struct closure *) GC_malloc(sizeof (struct closure));
#   endif
    
    result -> cl_fn = fn;
    result -> cl_data = data;
    return((GC_PTR)result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 963 of file dbg_mlc.c.

{
    unsigned i;

    GC_ASSERT(!I_HOLD_LOCK());
    if (GC_n_smashed == 0) return;
    GC_err_printf0("GC_check_heap_block: found smashed heap objects:\n");
    for (i = 0; i < GC_n_smashed; ++i) {
        GC_print_smashed_obj(GC_base(GC_smashed[i]), GC_smashed[i]);
       GC_smashed[i] = 0;
    }
    GC_n_smashed = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 387 of file dbg_mlc.c.

{
    register oh * ohdr = (oh *)GC_base(p);
    
    GC_ASSERT(!I_HOLD_LOCK());
    GC_err_printf1("0x%lx (", ((unsigned long)ohdr + sizeof(oh)));
    GC_err_puts(ohdr -> oh_string);
#   ifdef SHORT_DBG_HDRS
      GC_err_printf1(":%ld, ", (unsigned long)(ohdr -> oh_int));
#   else
      GC_err_printf2(":%ld, sz=%ld, ", (unsigned long)(ohdr -> oh_int),
                                    (unsigned long)(ohdr -> oh_sz));
#   endif
    GC_print_type((ptr_t)(ohdr + 1));
    GC_err_puts(")\n");
    PRINT_CALL_CHAIN(ohdr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GC_print_smashed_obj ( ptr_t  p,
ptr_t  clobbered_addr 
)

Definition at line 422 of file dbg_mlc.c.

{
    register oh * ohdr = (oh *)GC_base(p);
    
    GC_ASSERT(!I_HOLD_LOCK());
    GC_err_printf2("0x%lx in object at 0x%lx(", (unsigned long)clobbered_addr,
                                           (unsigned long)p);
    if (clobbered_addr <= (ptr_t)(&(ohdr -> oh_sz))
        || ohdr -> oh_string == 0) {
        GC_err_printf1("<smashed>, appr. sz = %ld)\n",
                     (GC_size((ptr_t)ohdr) - DEBUG_BYTES));
    } else {
        if (ohdr -> oh_string[0] == '\0') {
            GC_err_puts("EMPTY(smashed?)");
        } else {
            GC_err_puts(ohdr -> oh_string);
        }
        GC_err_printf2(":%ld, sz=%ld)\n", (unsigned long)(ohdr -> oh_int),
                                      (unsigned long)(ohdr -> oh_sz));
        PRINT_CALL_CHAIN(ohdr);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 346 of file dbg_mlc.c.

{
    hdr * hhdr = GC_find_header(p);
    char buffer[GC_TYPE_DESCR_LEN + 1];
    int kind = hhdr -> hb_obj_kind;

    if (0 != GC_describe_type_fns[kind] && GC_is_marked(GC_base(p))) {
       /* This should preclude free list objects except with   */
       /* thread-local allocation.                      */
       buffer[GC_TYPE_DESCR_LEN] = 0;
       (GC_describe_type_fns[kind])(p, buffer);
       GC_ASSERT(buffer[GC_TYPE_DESCR_LEN] == 0);
       GC_err_puts(buffer);
    } else {
       switch(kind) {
         case PTRFREE:
           GC_err_puts("PTRFREE");
           break;
         case NORMAL:
           GC_err_puts("NORMAL");
           break;
         case UNCOLLECTABLE:
           GC_err_puts("UNCOLLECTABLE");
           break;
#        ifdef ATOMIC_UNCOLLECTABLE
           case AUNCOLLECTABLE:
             GC_err_puts("ATOMIC UNCOLLECTABLE");
             break;
#        endif
         case STUBBORN:
           GC_err_puts("STUBBORN");
           break;
         default:
           GC_err_printf2("kind %ld, descr 0x%lx", kind, hhdr -> hb_descr);
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 117 of file alloc.c.

{ return(0); }
void GC_register_describe_type_fn ( int  kind,
GC_describe_type_fn  fn 
)

Definition at line 337 of file dbg_mlc.c.

{
  GC_describe_type_fns[kind] = fn;
}

Definition at line 453 of file dbg_mlc.c.

{
#   ifndef SHORT_DBG_HDRS
      GC_check_heap = GC_check_heap_proc;
      GC_print_all_smashed = GC_print_all_smashed_proc;
#   else
      GC_check_heap = GC_do_nothing;
      GC_print_all_smashed = GC_do_nothing;
#   endif
    GC_print_heap_obj = GC_debug_print_heap_obj_proc;
    GC_debugging_started = TRUE;
    GC_register_displacement((word)sizeof(oh));
}

Here is the call graph for this function:

Here is the caller graph for this function:

ptr_t GC_store_debug_info ( ptr_t  p,
word  sz,
GC_CONST char *  string,
word  integer 
)

Definition at line 242 of file dbg_mlc.c.

{
    register word * result = (word *)((oh *)p + 1);
    DCL_LOCK_STATE;
    
    /* There is some argument that we should dissble signals here.    */
    /* But that's expensive.  And this way things should only appear  */
    /* inconsistent while we're in the handler.                       */
    LOCK();
    GC_ASSERT(GC_size(p) >= sizeof(oh) + sz);
    GC_ASSERT(!(SMALL_OBJ(sz) && CROSSES_HBLK(p, sz)));
#   ifdef KEEP_BACK_PTRS
      ((oh *)p) -> oh_back_ptr = HIDE_BACK_PTR(NOT_MARKED);
#   endif
#   ifdef MAKE_BACK_GRAPH
      ((oh *)p) -> oh_bg_ptr = HIDE_BACK_PTR((ptr_t)0);
#   endif
    ((oh *)p) -> oh_string = string;
    ((oh *)p) -> oh_int = integer;
#   ifndef SHORT_DBG_HDRS
      ((oh *)p) -> oh_sz = sz;
      ((oh *)p) -> oh_sf = START_FLAG ^ (word)result;
      ((word *)p)[BYTES_TO_WORDS(GC_size(p))-1] =
         result[SIMPLE_ROUNDED_UP_WORDS(sz)] = END_FLAG ^ (word)result;
#   endif
    UNLOCK();
    return((ptr_t)result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void store_old ( GC_PTR  obj,
GC_finalization_proc  my_old_fn,
struct closure my_old_cd,
GC_finalization_proc ofn,
GC_PTR ocd 
) [static]

Definition at line 1069 of file dbg_mlc.c.

{
    if (0 != my_old_fn) {
      if (my_old_fn != GC_debug_invoke_finalizer) {
        GC_err_printf1("Debuggable object at 0x%lx had non-debug finalizer.\n",
                     obj);
        /* This should probably be fatal. */
      } else {
        if (ofn) *ofn = my_old_cd -> cl_fn;
        if (ocd) *ocd = my_old_cd -> cl_data;
      }
    } else {
      if (ofn) *ofn = 0;
      if (ocd) *ocd = 0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

size_t GC_debug_header_size = sizeof(oh)

Definition at line 467 of file dbg_mlc.c.

GC_describe_type_fn GC_describe_type_fns[MAXOBJKINDS] = {0} [static]

Definition at line 335 of file dbg_mlc.c.

unsigned GC_n_smashed = 0

Definition at line 945 of file dbg_mlc.c.

Definition at line 944 of file dbg_mlc.c.