diff options
Diffstat (limited to 'boehm-gc/dbg_mlc.c')
-rw-r--r-- | boehm-gc/dbg_mlc.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/boehm-gc/dbg_mlc.c b/boehm-gc/dbg_mlc.c index 6c4b2ba56b9..079e43be7cb 100644 --- a/boehm-gc/dbg_mlc.c +++ b/boehm-gc/dbg_mlc.c @@ -80,6 +80,16 @@ ptr_t p; return(FALSE); } +/* Return start of object that might have debugging info. */ +ptr_t GC_debug_object_start(p) +ptr_t p; +{ + register word * result = (word *)((oh *)p + 1); + if (! GC_has_debug_info(p)) + return(p); + return((ptr_t)result); +} + /* Store debugging info into p. Return displaced pointer. */ /* Assumes we don't hold allocation lock. */ ptr_t GC_store_debug_info(p, sz, string, integer) @@ -231,6 +241,35 @@ void GC_start_debugging() return (GC_store_debug_info(result, (word)lb, s, (word)i)); } +# ifdef __STDC__ + GC_PTR GC_debug_generic_malloc(size_t lb, int k, EXTRA_ARGS) +# else + GC_PTR GC_debug_malloc(lb, k, s, i) + size_t lb; + int k; + char * s; + int i; +# ifdef GC_ADD_CALLER + --> GC_ADD_CALLER not implemented for K&R C +# endif +# endif +{ + GC_PTR result = GC_generic_malloc(lb + DEBUG_BYTES, k); + + 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)); +} + #ifdef STUBBORN_ALLOC # ifdef __STDC__ GC_PTR GC_debug_malloc_stubborn(size_t lb, EXTRA_ARGS) @@ -627,3 +666,28 @@ struct closure { GC_register_finalizer_ignore_self(base, GC_debug_invoke_finalizer, GC_make_closure(fn,cd), ofn, ocd); } + +# ifdef __STDC__ + void GC_debug_register_finalizer_no_order + (GC_PTR obj, GC_finalization_proc fn, + GC_PTR cd, GC_finalization_proc *ofn, + GC_PTR *ocd) +# else + void GC_debug_register_finalizer_no_order + (obj, fn, cd, ofn, ocd) + GC_PTR obj; + GC_finalization_proc fn; + GC_PTR cd; + GC_finalization_proc *ofn; + GC_PTR *ocd; +# endif +{ + ptr_t base = GC_base(obj); + if (0 == base || (ptr_t)obj - base != sizeof(oh)) { + GC_err_printf1( + "GC_register_finalizer_no_order called with non-base-pointer 0x%lx\n", + obj); + } + GC_register_finalizer_no_order(base, GC_debug_invoke_finalizer, + GC_make_closure(fn,cd), ofn, ocd); +} |